'Interesting/ANDROID'에 해당되는 글 50

  1. 2010.01.21 [ANDROID] color mask 예제 4
  2. 2009.11.06 [ADC2] round 1 200 application
  3. 2009.10.28 [Android]Android 2.0 Platform 출시
Interesting/ANDROID | Posted by hyena0 2010. 1. 21. 21:14

[ANDROID] color mask 예제



 [ANDROID] color mask 예제

  과거에 작성했던 컬러마스크 예제를 첨부합니다.

  지속적으로 SDK 가 업데이트 되는 바람에 커스터마이징을

  해야할 겁니다.

  현재 1.6 SDK 환경에서는 동작하지 않는 군요.

  G1 폰이 업데이트가 되질 않아서 SDK 업그레이드도 멈췄지요.

  bmptest 라는 프로젝트로 작성된 코드는 아래와 같습니다.

package com.google.android.bmptest;

import android.app.Activity;
import android.os.Bundle;
import android.widget.*;
import android.graphics.*;
import android.graphics.drawable.*;
import android.view.*;

public class bmptest extends Activity {
    /** Called when the activity is first created. */

 public int[]    mColors;
    @Override
    public void onCreate(Bundle icicle) {
     
        super.onCreate(icicle);
        LinearLayout linLayout = new LinearLayout(this);
        
           Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),
               R.drawable.fedor);  //drawable 폴더에 fedor.bmp라는 파일이 있어야 합니다.
                                           // 원하는 파일을 넣고 파일명을 바꾸면 되겠죠.
        int width = bitmapOrg.getWidth();
        int height = bitmapOrg.getHeight();
        int newWidth = 300;
        int newHeight = 300; 
        //RGB 호출
        int[] colors = new int[width*height];
        int[][] rgbCol = new int[3][width*height];
        for(int i=0;i<2;i++){
         mColors = mask2Colors(bitmapOrg,i);
         rgbCol[i] = mColors;
        }
        for(int j=0;j<(width*height);j++){
         colors[j] = rgbCol[0][j]|rgbCol[1][j]|rgbCol[2][j]; 
        }
       
               
        // calculate the scale - in this case = 0.4f
        float scaleWidth = ((float) newWidth) / width;
        float scaleHeight = ((float) newHeight) / height;
       
        // createa matrix for the manipulation
        Matrix matrix = new Matrix();
        // resize the bit map
        matrix.postScale(scaleWidth, scaleHeight); 
        // recreate the new Bitmap
        Bitmap resizedBitmap = Bitmap.createBitmap(colors, 0, width,width,height,//STRIDE, WIDTH, HEIGHT,
                Bitmap.Config.RGB_565);
        Bitmap resizedBitmap1 =
         Bitmap.createBitmap(resizedBitmap, 0, 0,
                          width, height, matrix, true);
   
        // make a Drawable from Bitmap to allow to set the BitMap
        // to the ImageView, ImageButton or what ever

        BitmapDrawable bmd = new BitmapDrawable(resizedBitmap1);
       
        ImageView imageView = new ImageView(this);
       
        // set the Drawable on the ImageView
        imageView.setImageDrawable(bmd);
     
        // center the Image
        imageView.setScaleType(ImageView.ScaleType.CENTER);
            
        // add ImageView to the Layout
        linLayout.addView(imageView,
          new LinearLayout.LayoutParams(
                      LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT
                )
        );
       
        // set LinearLayout as ContentView
        setContentView(linLayout);
    }
   

  private int[] mask2Colors(Bitmap bitmapO, int sltColor) {
     int W,H,ST;
     int orgColor=0;
     int greenColor=0;
     //get Height and Width
     H=bitmapO.getHeight();
     W=bitmapO.getWidth();
     ST = W;
          
     int[] colors = new int[ST * H];
     int avrColor=0;
      //make mask
      int[] masks = {1,1,1,1,1,1,1,1,1};
      //Mask height, width
     int Mh = 3; int Mw =3;
      //blur
     int var=0;
            
     //get bitmap color
      for (int y = 0; y < H; y++) {
             for (int x = 0; x < W; x++) {
              if(sltColor == 0){
               orgColor = Color.red(bitmapO.getPixel(x, y));
              }
              if(sltColor == 1){
               orgColor = Color.green(bitmapO.getPixel(x, y));
              }
              if(sltColor == 2){
               orgColor = Color.blue(bitmapO.getPixel(x, y));
              }
              colors[y * ST + x] = orgColor;
             }
         }
      //calc. average value of colors
     for (int i=0;i<H*W;i++){
      avrColor += colors[i];
     }
     avrColor /= H*W;
     //mask the color
     //i는 계산될 높이 계산될 폭만큼의 반복범위임

     for (int i=0;i<(H-Mh)*(W-Mw);i++){
      
       //mask 계산
        var = colors[i]*masks[0]      + colors[i+1]*masks[1]      + colors[i+2]*masks[2]
             +colors[W+i]*masks[3]    + colors[W+i+1]*masks[4]    + colors[W+i+2]*masks[5]
             +colors[(W+1)+i]*masks[6]+ colors[(W+1)+i+1]*masks[7]+ colors[(W+1)+i+2]*masks[8];
        
        var = var/9; //1/9 효과를 나타냄
        //blur일 경우는 평균값 더하지 않기
        //var +=avrColor;
        colors[i]=var;
        var =0;//var 초기화       
     }
     
     //make argb style
        for (int y = 0; y < H; y++) {
            for (int x = 0; x < W; x++) {
             if(sltColor ==0){
              orgColor = colors[y * ST + x];
              orgColor = orgColor<<16;//red shift
              orgColor = 0x00FF0000 & orgColor;
             }
             if(sltColor ==1){
              orgColor = colors[y * ST + x];
              orgColor = orgColor<<8;//green shift
              orgColor = 0x0000FF00 & orgColor;
             }
             if(sltColor == 2){
              orgColor = colors[y * ST + x];
             }
             colors[y * ST + x] = orgColor;
            }
        }
      return colors;
    }
   }

  이상과 같습니다.

  주석을 보고 이해 안가는 부분이 있으시면 답글주세요.

 

 

 

Interesting/ANDROID | Posted by hyena0 2009. 11. 6. 20:04

[ADC2] round 1 200 application


  [ADC2] round 1 200 application

안드로이드 개발자 챌린지 2의 1차 어플리케이션이

드디어 발표되었네요.

애석하지만, 나의 어플인 ARU는 순위권에 들지 못했습니다.

ADC로 부터 받은 이메일에는 하위 50%의 순위에

들었다고 하네요.

어쨌거나 어떤 어플들이 수상하게 될지 궁금하네요.

이제 라운드 2로 들어간답니다.

안드로이드 펍에서 등록되었던 한국인 개발자의 어플들이

눈에 띄네요. 선전하시길...

Congratulations to the top 200 apps from ADC 2 Round 1.

Android ApplicationCategory
4 Player Reactor (ADC) Arcade
A World Of Photo Entertainment
A-GLOBAL-MIND Social
A.D.A.M Entertainment
Agile Messenger IM Social
AirPainter Lifestyle
Album Art Grabber for ADC2 Lifestyle
Alex Digital Secretary Productivity
aLock Misc
Always Prompt Travel
AMon (adc2 version) Lifestyle
Andrometer 1.0 Misc
AndShowtime Misc
Animal Compass Misc
AnyStop: The Transit Companion Travel
AnyWidget Misc
aPortaDrum Multimedia
AppManager (ADC2-edition) Productivity
Apps Organizer Adc Productivity
Appshare Social
aShadow Finder Lifestyle
Atmosphere: Trainer Arcade
Atomic Blaster Arcade
BabelSnap! (Trial) Travel
Bambuser ADC2 Social
Bazooka Rabbit Demo For ADC Arcade
Blink Casual
Blockx 3D Pro (ADC2) Casual
Books-EX Social
Botanica Education
Buzz Deck beta Multimedia
Calton Hill GPSCaddy Misc
Car Locator Travel
Cartoon Gang Social
Ce:real - Everyday trends Social
Celeste Education
ChordBot Multimedia
Citizenside Multimedia
ClapCard Social
Comeks Microphone Hero Casual
Complete Memorization Education
CubeWorks Productivity
Daisy Garden Entertainment
Decades Casual
Decaf: EC2 on your Android Misc
Detexify: LaTeX Recognizer Education
Dialify Misc
Digital Recipe Sidekick Lifestyle
DJ'it Lifestyle
Drive - AR Navigation System Travel
Drocap Productivity
DroidSpray Entertainment
EarthTime Education
Eclosion Productivity
Entertain Me Entertainment
Event Flow Productivity
Executive Assistant Misc
Flash of Genius: SAT Vocab Education
Flick It! Casual
FlingTap Done Productivity
Flu Tracker Education
FlyScreen Misc
Food Canary in a Restaurant Travel
FoxyRing ADC2 Lifestyle
FRG Arcade
Friend or Foe Social
FriendBook Lifestyle
Fun Buzz Widget Entertainment
FUN2Learn Education
Fusion WebServer - Phone2Web Productivity
FxCamera (for ADC2) Multimedia
g-tar Entertainment
GangWars Arcade
GeoNotes Social
Gigbox Lifestyle
Golfuls Entertainment
GPS Toolbox ADC2 Travel
Graviturn 1.0 Arcade
Grooveshark Mobile Multimedia
Handcent Messaging Productivity
Handy Poll ADC Productivity
Head To Head Racing Arcade
Hoccer ADC2 Productivity
HotelsByMe: Hotel Reservations Travel
How-To Videos from Howcast.com Multimedia
iLomo Entertainment
iNap: Arrival Alert (ADC2) Travel
InTrouble Lifestyle
JAM session Entertainment
Jelix Casual
JumpyBall 3D Arcade
KAN-BAN WORLD Misc
Kanji with Picture Education
KUMPA Casual
LawLocale Travel
Learn! Education
Light Racer 3D Trial Arcade
Locale Ping.fm Plug-In Social
Lucid ADC2 Casual
Manchego! Education
Maverick Travel
Mazeness Casual
medAssist.me Misc
Mediafly Mobile ADC Edition Multimedia
MeetByChance.me Social
MicroJam Multimedia
midNite movie Entertainment
Missing Children ADC Misc
mobilematics Education
mobiProfessor Education
Mobisle Notes Productivity
Mom's shopping list Lifestyle
Moto X Mayhem Arcade
Mover Lifestyle
MoVue Travel
Mowsic Midi-Over-Wireless Multimedia
mPuzzle Casual
MultiLex English Explanatory Education
musikCube Multimedia
MyPosition Travel
N. American Conquest (ADC) Casual
Nebudroid Entertainment
NetDroid Lifestyle
NewsRoom Productivity
Nintaii Casual
Office Exercise Misc
Open Gesture Misc
Personal Finance Misc
Phonebook Sharing Social
PhoneHotel Travel
Photo BURST ADC2 Multimedia
PhotoShoot - The Duel (ADC) Arcade
PhotSpot(ADC2ver) Travel
PickYouUp Travel
Plink Art Education
Pobs Casual
PocketDJ Multimedia
Pocoro Casual
PrivateMedia Multimedia
ProjectINF ADC Arcade
Radiant Arcade
Rhythm Guitar Misc
Rhythmatics™ Alpha Lifestyle
Robotic Guitarist (ADC2) Education
Runes MMORPG - Alpha release Arcade
Screebl Productivity
Scribble Social
Scribtor Misc
Seek ’n Spell Casual
SFR Postcard Entertainment
Sign Translation Travel
SingSong Entertainment
Sketch Online Casual
Smart Alarm Clock Lifestyle
SocialMuse Social
Solo - ADC2 Entertainment
SongDNA Entertainment
Sonorox (ADC2) Entertainment
Space STG - Galactic Wars Arcade
SPB TV for ADC Multimedia
Spectral Audio Analyzer ADC2 Multimedia
SpecTrek Lifestyle
Speed Forge 3D Arcade
Spheremare Arcade
Sports Trek Travel
SpotMessage for ADC2 Social
Stroids - ADC2 Arcade
Subzero Challenge Arcade
Sudoku Camera Casual
SweetDreams Lifestyle
Swift Twitter App (ADC2) Social
TapDialer Misc
Taps Of Fire Entertainment
Tasker Productivity
taskTopia Productivity
Tesla - PC Remote Control Multimedia
TextEZFast Social
Thinking-Space Productivity
Time-Lapse Trial Multimedia
Todoroo Lifestyle
TopoDroid Travel
Totemo Casual
Tracklet Productivity
Trip Journal Travel
Trippo Education
TuneMagic Multimedia
TweetAssist Social
Uloops Multimedia
UrbanGolf light Casual
Voicetrans (ADC) Education
WaveSecure Productivity
Web Clip Widget Lifestyle
WebWidget Misc
What the Doodle!? (ADC2) Casual
Who's Calling Entertainment
Word Puzzle Education
Xeeku Photo Journal Lifestyle
Xeeku Twitter Social
Yuilop Entertainment
Zenith Education
Interesting/ANDROID | Posted by hyena0 2009. 10. 28. 07:31

[Android]Android 2.0 Platform 출시



  Android 2.0 Platform 출시

  안드로이드 2.0 이 출시되었습니다.

  1.6이 나온지 얼마되지 않았는데, 업데이트가 빠르군요.

  여러가지 변화를 적용하고 있는 것같네요.

  동영상에서는 크게 네가지로 보여주고 있네요.

  "Contacts and Account", "Quick Contact",

  "Bluetooth", ""다양한 Screen size 지원" 등입니다.

  개발자 사이트를 보면 더 자세한 내용을 볼 수 있고 SDK를 다운로드 받을 수 있습니다.

  


Contacts and accounts

  • Multiple accounts can be added to a device for email and contact synchronization, including Exchange accounts. (Handset manufacturers can choose whether to include Exchange support in their devices.)
  • Developers can create sync adapters that provide synchronization with additional data sources.
  • Quick Contact for Android provides instant access to a contact's information and communication modes. For example, a user can tap a contact photo and select to call, SMS, or email the person. Other applications such as Email, Messaging, and Calendar can also reveal the Quick Contact widget when you touch a contact photo or status icon.

Email

  • Exchange support.
  • Combined inbox to browse email from multiple accounts in one page.

Messaging

  • Search functionality for all saved SMS and MMS messages.
  • Auto delete the oldest messages in a conversation when a defined limit is reached.

Camera (여긴 아이폰과 닮아가는군요)

  • Built-in flash support
  • Digital zoom
  • Scene mode
  • White balance
  • Color effect
  • Macro focus

Android virtual keyboard

  • An improved keyboard layout to makes it easier to hit the correct characters and improve typing speed.
  • The framework's multi-touch support ensures that key presses aren't missed while typing rapidly with two fingers.
  • A smarter dictionary learns from word usage and automatically includes contact names as suggestions.

Browser

  • Refreshed UI with actionable browser URL bar enables users to directly tap the address bar for instant searches and navigation.
  • Bookmarks with web page thumbnails.
  • Support for double-tap zoom.
  • Support for HTML5:  (HTML5를 지원한다는 사실이 고무적이네요)

    • Database API support, for client-side databases using SQL.
    • Application cache support, for offline applications.
    • Geolocation API support, to provide location information about the device.
    • <video> tag support in fullscreen mode.

Calendar

  • Agenda view provides infinite scrolling.
  • Events indicate the attending status for each invitee.
  • Invite new guests to events.