'Programming'에 해당되는 글 8건

  1. 2010.08.02 리스너
  2. 2010.08.02 Memo
  3. 2010.07.09 PaintTest 3
  4. 2010.07.05 레이아웃
  5. 2010.06.27 비트맵 및 이미지 처리 - 바탕 화면 이미지 저장 및 실행
  6. 2010.06.27 비트맵 및 이미지 처리 - 흑백 변환 1
  7. 2010.06.22 ArrayList
  8. 2010.06.22 비트맵과 이미지 처리 1
Programming/Android2010. 8. 2. 22:14
mEdit.addTextChangeListener(mWatcher);


TextWatcher mWatcher = new TextWatcher(){
     public void afterTextChanged(Editable s){
     }
    
     public void beforeTextChanged(CharSequence s, int start, int count,
     int after){
     }
    
     public void onTextChanged(CharSequence s, int start, int before, int count){
     mText.setText("echo: " + s);
     }
    };

'Programming > Android' 카테고리의 다른 글

Memo  (0) 2010.08.02
PaintTest  (3) 2010.07.09
레이아웃  (0) 2010.07.05
Posted by zzibong
Programming/Android2010. 8. 2. 22:06
// 매니페스트
<activity android:windowSoftInputMode="adjustResize" />

mEdit.setFilters(new InputFilter[]{
         new InputFilter.LengthFilter(5)
        });

'Programming > Android' 카테고리의 다른 글

리스너  (0) 2010.08.02
PaintTest  (3) 2010.07.09
레이아웃  (0) 2010.07.05
Posted by zzibong
Programming/Android2010. 7. 9. 00:35

public void onDraw(Canvas canvas){
     Paint Pnt = new Paint();
     canvas.drawColor(Color.WHITE);

     // 캡 모양 테스트
     Pnt.setColor(Color.BLUE);
     Pnt.setStrokeWidth(14);
     canvas.drawLine(10, 10, 200, 10, Pnt);
     Pnt.setStrokeCap(Paint.Cap.ROUND);
     canvas.drawLine(10, 30, 200, 30, Pnt);
     Pnt.setStrokeCap(Paint.Cap.SQUARE);
     canvas.drawLine(10, 50, 200, 50, Pnt);
    
     // 조인 모양 테스트
     Pnt.setColor(Color.BLACK);
     Pnt.setStrokeWidth(15);
     Pnt.setStyle(Paint.Style.STROKE);
     Pnt.setStrokeJoin(Paint.Join.MITER);
     canvas.drawRect(10, 80, 60, 130, Pnt);
     Pnt.setStrokeJoin(Paint.Join.BEVEL);
     canvas.drawRect(80, 80, 130, 130, Pnt);
     Pnt.setStrokeJoin(Paint.Join.ROUND);
     canvas.drawRect(150, 80, 200, 130, Pnt);
    
     // 스타일 테스트
     Pnt.setStrokeWidth(5);
     Pnt.setColor(Color.RED);
     Pnt.setStyle(Paint.Style.FILL);
     canvas.drawCircle(30, 180, 20, Pnt);
     Pnt.setStyle(Paint.Style.STROKE);
     canvas.drawCircle(80, 180, 20, Pnt);
     Pnt.setStyle(Paint.Style.FILL_AND_STROKE);
     canvas.drawCircle(130, 180, 20, Pnt);
     Pnt.setColor(Color.BLUE);
     canvas.drawCircle(180, 180, 20, Pnt);
     Pnt.setStyle(Paint.Style.FILL);
     Pnt.setColor(Color.RED);
     Pnt.setStyle(Paint.Style.STROKE);
     canvas.drawCircle(180, 180, 20, Pnt);
     }

출처 - 안드로이드 프로그래밍 정복

'Programming > Android' 카테고리의 다른 글

리스너  (0) 2010.08.02
Memo  (0) 2010.08.02
레이아웃  (0) 2010.07.05
Posted by zzibong
Programming/Android2010. 7. 5. 21:37


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<Button
android:id="@+id/btnpage1"  
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:text="Page 1"
/>
<Button
android:id="@+id/btnpage2"  
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:text="Page 2"
/>
<Button
android:id="@+id/btnpage3"  
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:text="Page 3"
/>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:id="@+id/page1"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffff00"
>
<TextView  
android:layout_width="match_parent" 
android:layout_height="wrap_content"
android:textColor="#000000" 
android:text="첫 번째 페이지"
/>
<ImageView  
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:src="@drawable/pride"
/>
</LinearLayout>
<RelativeLayout
android:id="@+id/page2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:background="#00ff00"
>
<EditText
android:layout_width="wrap_content" 
android:layout_height="wrap_content"
android:layout_alignParentRight="true" 
android:text="두번째 페이지"
/>
<Button
android:layout_width="wrap_content" 
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" 
android:text="Button"
/>
</RelativeLayout>
<TableLayout
android:id="@+id/page3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
android:background="#0000ff"
>
<TableRow>
<TextView android:text="국어" android:textSize="15pt" android:padding="10px" />
<TextView android:text="영어" android:textSize="15pt" android:padding="10px" />
<TextView android:text="수학" android:textSize="15pt" android:padding="10px" />
</TableRow>
<TableRow>
<TextView android:text="88" android:textSize="15pt" android:padding="10px" />
<TextView android:text="92" android:textSize="15pt" android:padding="10px" />
<TextView android:text="76" android:textSize="15pt" android:padding="10px" />
</TableRow>
</TableLayout>
</FrameLayout>
</LinearLayout>


참고서 - 안드로이드 프로그래밍 정복

'Programming > Android' 카테고리의 다른 글

리스너  (0) 2010.08.02
Memo  (0) 2010.08.02
PaintTest  (3) 2010.07.09
Posted by zzibong
Programming/MFC2010. 6. 27. 18:12


#include <atlimage.h>

void CSaveGrayDemoView::OnRButtonDown(UINT nFlags, CPoint point)
{
// 바탕 화면 윈도우 객체에 대한 포인터를 얻음
CWnd* pWndDesktop = GetDesktopWindow();
CWindowDC ScrDC(pWndDesktop);
CClientDC dc(this);

// 바탕 화면 윈도우의 크기를 알아낸다.
CRect Rect;
pWndDesktop->GetWindowRect(&Rect);

// 바탕 화면 크기 및 색상 수와 동일한 비트맵 이미지를 만든다.
CImage Image;
int cx = Rect.Width();
int cy = Rect.Height();
Image.Create(
cx, cy, ScrDC.GetDeviceCaps(BITSPIXEL));

// 이미지 DC와 화면 DC에 바탕 화면 윈도우 화면을 출력한다.
CDC* pDC = CDC::FromHandle(Image.GetDC());
pDC->BitBlt(0, 0, cx, cy, &ScrDC, 0, 0, SRCCOPY);
dc.BitBlt(0, 0, cx, cy, pDC, 0, 0, SRCCOPY);
Image.ReleaseDC();

// JPEG 형식으로 바탕
 화면 이미지를 저장한다.
Image.Save(_T("Desktop.jpg"), Gdiplus::ImageFormatJPEG);
// 저장된 이미지를 뷰어를 실행하여 보여준다.
::ShellExecute(NULL,
_T("open"), _T("Desktop.jpg"),
NULL, NULL, SW_SHOW);

CView::OnRButtonDown(nFlags, point);
}

'Programming > MFC' 카테고리의 다른 글

비트맵 및 이미지 처리 - 흑백 변환  (1) 2010.06.27
비트맵과 이미지 처리  (1) 2010.06.22
Posted by zzibong
Programming/MFC2010. 6. 27. 17:38


#include <atlimage.h>
inline void RGBtoGray(COLORREF& rgb)
{
BYTE byGray = (GetRValue(rgb) * 30
+ GetGValue(rgb) * 59
+ GetBValue(rgb) * 11)/100;
rgb = RGB(byGray, byGray, byGray);
}

void CSaveGrayDemoView::OnLButtonDown(UINT nFlags, CPoint point)
{
// 바탕 화면 윈도우 객체에 대한 포인터를 얻음
CWnd* pWndDesktop = GetDesktopWindow();  // 바탕 화면 윈도우 DC
CWindowDC ScrDC(pWndDesktop);                // 뷰 윈도우 DC
CClientDC dc(this);

// 바탕 화면 크기 및 색상수와 동일한 비트맵 이미지를 만든다.
CImage Image;
Image.Create(300, 300, ScrDC.GetDeviceCaps(BITSPIXEL));

// 이미지 DC와 화면 DC에 바탕 화면 윈도우 DC를 출력한다.
CDC* pDC = CDC::FromHandle(Image.GetDC());
pDC->BitBlt(0, 0, 300, 300, &ScrDC, 0, 0, SRCCOPY);
Image.ReleaseDC();

// 일부(200 * 200)를 흑백 이미지로 변환
COLORREF rgb;
for(int x = 0; x < 200; x++)
{
for(int y = 0; y < 200; ++y)
{
rgb = Image.GetPixel(x, y);
// Gray RGB 값으로 변환
RGBtoGray(rgb);
Image.SetPixel(x, y, rgb);
}
}

// 흑백으로 변환된 이미지를 화면 DC에 출력
Image.BitBlt(dc.m_hDC, 0, 0);

CView::OnLButtonDown(nFlags, point);
}
Posted by zzibong
Programming/Java2010. 6. 22. 23:56

import java.util.ArrayList;

ArrayList<Egg> myList = new ArrayList<Egg>(); 
// 새로 만듭니다.

Egg s = new Egg();
myList.add(s);
// 객체 매개변수 Egg를 목록에 추가합니다.

int theSize = myList.size();
// 현재 목록에 들어있는 원소의 개수를 리턴합니다.

boolean isIn = myList.contains(s);
// 객체 매개변수 s가 목록에 있으면 true를 리턴합니다.

int idx = myList.indexOf(s);
// 객체 매개변수 s의 인덱스 또는 -1을 리턴합니다.

boolean empty = myList.isEmpty();
// 목록에 아무 원소도 없으면 true를 리턴합니다.

myList.remove(s);
// 주어진 객체가 ArrayList에 있으면 그 객체를 제거합니다.

myList.get(int index);
// 주어진 index 매개변수 위치에 있는 객체를 리턴합니다.
Posted by zzibong
Programming/MFC2010. 6. 22. 00:59



void CBmpDisplayDemoView::OnPaint()
{
 CPaintDC dc(this); // device context for painting
 
 CDC MemDC;
 BITMAP bmpInfo;
 // 화면 DC와 호환되는 메모리 DC 생성
 MemDC.CreateCompatibleDC(&dc);
 // 비트맵 리소스 로딩
 CBitmap bmp;
 CBitmap *pOldBmp = NULL;
 bmp.LoadBitmap(IDB_BITMAP1);
 // 로딩된 비트맵 정보
 bmp.GetBitmap(&bmpInfo);
 // 메모리 DC에 선택
 pOldBmp = MemDC.SelectObject(&bmp);
 // 메모리 DC에 비트맵을 화면 DC로 복사하여 출력
 dc.StretchBlt(20, 20,
  bmpInfo.bmWidth * 2, bmpInfo.bmHeight * 2,
  &MemDC,
  0, 0,
  bmpInfo.bmWidth, bmpInfo.bmHeight,
  SRCCOPY);  // 래스터 연산 값

 dc.TransparentBlt(20, 100,
  bmpInfo.bmWidth * 2, bmpInfo.bmHeight * 2,
  &MemDC,
  0, 0,
  bmpInfo.bmWidth, bmpInfo.bmHeight,
  RGB(0, 0, 0)); // 투명 처리될 색상의 RGB

 MemDC.SelectObject(pOldBmp);

}



/*
래스터 연산
SRCCOPY                    // 메모리 DC의 내용에 변화를 주지 말고 그대로 화면 DC에 복사
SRCAND                       // 원본과 대상을 AND 연산하여 출력
NOTSRCCOPY              // 원본 이미지의 색상을 반전시켜 출력
DSTINVERT                   // 원본 이미지와는 상관없이 대상 이미지를 반전시켜 출력


BOOL BitBlt(
   int x, int y,                   // 출력할 윈도우의 좌표
   int nWidth, int nHeight,  // 출력할 비트맵의 폭과 높이
   CDC* pSrcDC,             // 출력할 비트맵을 저장한 메모리 DC의 주소
   int xSrc, int ySrc,          // 메모리 DC에 들어 있는 비트맵의 시작 좌표
   DWORD dwRop            // 적용할 래스터 연산
);

dc.StretchBlt(200, 200,  // 출력될 좌표
     250 * 2, 300 * 2,     // 폭과 높이를 두배 확대
     &MemDC,
     350, 200,               // 원본 이미지 좌표
     250, 300,               // 원본 이미지의 폭과 높이
     SRCCOPY
);
*/

Posted by zzibong