보호된 글: 스크래치(중간고사 형식)
보호 글이라서 요약이 없습니다.
보호 글이라서 요약이 없습니다.
Gpro 루팅 준비 1. 동기화 프로그램 및 usb 드라이버 다운로드 및 설치 2. window용 adb 다운로드 3. 루팅에 필요한 core파일 다운로드 루팅 과정 1. 휴대폰에서 usb 디버깅 체크(디버깅이 보이지 않는경우, 설정->휴대폰정보->소프트웨어정보->빌드번호 10회이상 터치) 2. pc와 휴대폰 연결 3. cmd 관리자 권한으로 실행 4. adb 다운받은 위치로 이동 (cd c:\download) 5.… Continue Reading LG Gpro 개발자모드 추가
애드몹 (http://kr.admob.com/)에 가입한다. 애드몹에 배너 광고 또는 전면 광고를 생성한다. Manifest.xml 파일에 다음 내용 추가
1 2 3 4 5 6 7 8 9 10 11 |
<manifest ...> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <application ...> ... <activity android:name="com.google.android.gsm.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent"/> </application> </manifest> |
배너광고달기 activity_main.xml 파일에 다음 내용 추가
1 2 3 4 5 6 7 8 |
<com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" ads:adUnitId="@string/ad_unit_id" ads:adSize="BANNER" /> |
MainActivity.java 파일의 onCreate() 메소드에 다음 내용 추가
1 2 3 4 5 6 |
protected void onCreate(Bundle savedInstanceState) { ... AdView adView = (AdView) this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); } |
전면광고 달기 MainActivity.java 파일의 onCreate() 메소드에 다음 내용 추가
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
private InterstitialAd m_fullAds; //전면광고 protected void onCreate(Bundle savedInstanceState) { ... m_fullAds = new InterstitialAd(this); m_fullAds.setAdUnitId(getString(R.string.FULL_AD_UNIT_ID)); AdRequest adRequest2 = new AdRequest.Builder().build(); m_fullAds.loadAd(adRequest2); /*fullAds.setAdListener(new AdListener() { @Override public void onAdLoaded() { Log.i("MY_TAG", "Complete.."); //f_displayFullAds(); super.onAdLoaded(); } });*/ } private void f_displayFullAds(){ if(m_fullAds != null && m_fullAds.isLoaded()){ m_fullAds.show(); } } |
onKeyDown() 메소드를 사용
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(event.getAction() == KeyEvent.ACTION_DOWN){ if(keyCode == KeyEvent.KEYCODE_BACK){ //Toast.makeText(this, "test", Toast.LENGTH_SHORT).show(); new AlertDialog.Builder(this) .setTitle("종료확인") .setMessage("정말로 종료하시겠습니까?") .setPositiveButton("예", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); } }) .setNegativeButton("아니오", null) .create().show(); } } return super.onKeyDown(keyCode, event); } |
참조 파일들 DB생성을 위한 엑셀파일 : 다운로드 만들어진 DB 파일 : 다운로드 수업용 파일 : 다운로드 File – New – New Project 메뉴 순으로 클릭한다. … 나오는 대화상자에 맞춰 내용을 작성한다. 프로젝트가 생성되면 다음 4개의 파일을 순서대로 열어 놓는다. app/manifests/AndroidManifest.xml app/res/values/strings.xml app/res/layout/activity_main.xml app/java/kr.ac.jj.hanjaapp/MainActivity app/res/values/strings.xml 파일을 다음과 같이 작성한다. 문자열 1개… Continue Reading 안드로이드 앱 개발(한자교육)
이 장에서 배우는 기능 블록 만들기 : 스크래치에서 제공하지 않는 블록을 사용자가 직접 만들어 사용 삼각형 그리는 블록 예 Pencil을 이용하여 프로젝트 만들기 실전7-1(p96) 0.5초 간격으로 매개변수(len)만큼 오른쪽으로, 왼쪽으로 반복 이동하는 rightleft 블록 정의하기 실전7-2(p99) 매개변수(len) 길이를 가지는 정육각형을 그리는 hexagon 블록 정의하기 실전7-3(p102) hexagon 블록을 이용하여 육각형 3개 그리기… Continue Reading 거미줄 모양의 도형 그리기
이 장에서 배우는 기능 펜으로 그리기 : 펜 내리기/올리기, 색상/명암/굵기 조절하기 블록 익히기 0 ~ 200사이의 색을 반복사용 빨간색(0), 오렌지색(20), 노란색(35), 녹색(70), 파란색(130), 보라색(150), 빨간색(200) 0:가장 어두움 ~ 100:가장 밝음 Monkey2, Pencil, Button을 이용하여 프로젝트 만들기 Monkey2 스크립트 시작할 때 : Monkey2가 나타나고, “다각형을 그리려면 draw 버튼을 누르고, 지우려면 clear… Continue Reading 다각형 그리기(펜)
메뉴를 다음과 같이 추가한다. [영역_확대(픽셀복제)] 메뉴를 더블클릭한 후 다음코드를 완성한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
private void 기하확대픽셀복제ToolStripMenuItem_Click(object sender, EventArgs e) { Bitmap bmp = f_OpenBitmapFile(); if (bmp == null) return; byte[] data = f_getDataFromImage(bmp); ///////// Start Image Processing //////////////// double scale_x = 2; double scale_y = 2; int width = bmp.Width; int height = bmp.Height; int depth = data.Length / width / height; int newWidth = (int)(bmp.Width * scale_x); int newHeight = (int)(bmp.Height * scale_y); byte[] newdata = new byte[newWidth * newHeight * depth]; for (int y = 0; y < newHeight; y++) { for (int x = 0; x < newWidth; x++) { for (int d = 0; d < depth; d++) { newdata[(y * newWidth + x) * depth + d] = data[((int)(y / scale_y) * width + (int)(x / scale_x)) * depth + d]; } } } ///////// End Image Processing //////////////// Bitmap bmpResult = f_makeImageFromData(newWidth, newHeight, bmp.PixelFormat, newdata); f_drawImage(bmp, bmpResult); } |
[기하_확대(양선형보간법)] 메뉴를 더블클릭한 후 다음코드를 완성한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
///////// Start Image Processing //////////////// double scale_x = 2; double scale_y = 2; int newWidth = (int)(bmp.Width * scale_x); int newHeight = (int)(bmp.Height * scale_y); byte[] newdata = new byte[(int)(newWidth * newHeight)]; for (int y = 0; y < newHeight; y++) { for (int x = 0; x < newWidth; x++) { // 원시 영상에서의 픽셀 좌표 계산 double alpha = x / scale_x - (int)(x / scale_x); double beta = y / scale_y - (int)(y / scale_y); // 보간에 사용된 4 픽셀의 좌표 계산 int Ax = (int)(x / scale_x); int Ay = (int)(y / scale_y); int Bx = Ax + 1; int By = Ay; int Cx = Ax; int Cy = Ay + 1; int Dx = Ax + 1; int Dy = Ay + 1; // 픽셀 위치가 영상의 경계를 벗어나는지 검사 if (Bx > bmp.Width - 1) Bx = bmp.Width - 1; if (Dx > bmp.Width - 1) Dx = bmp.Width - 1; if (Cy > bmp.Height - 1) Cy = bmp.Height - 1; if (Dy > bmp.Height - 1) Dy = bmp.Height - 1; // x 방향으로 보간 double E = data[Ay * bmp.Width + Ax] * (1 - alpha) + data[By * bmp.Width + Bx] * alpha; double F = data[Cy * bmp.Width + Cx] * (1 - alpha) + data[Dy * bmp.Width + Dx] * alpha; // y 방향으로 보간 newdata[y * newWidth + x] = (byte)(E * (1 - beta) + F * beta); } } ///////// End Image Processing //////////////// |
[기하_축소(서브샘플링)] 메뉴를 더블클릭한 후 다음코드를 완성한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
///////// Start Image Processing //////////////// double scale_x = 2; double scale_y = 1.5; int width = bmp.Width; int height = bmp.Height; int depth = data.Length / width / height; int newWidth = (int)(bmp.Width / scale_x); int newHeight = (int)(bmp.Height / scale_y); byte[] newdata = new byte[newWidth * newHeight * depth]; for (int y = 0; y < newHeight; y++) { for (int x = 0; x < newWidth; x++) { for (int d = 0; d < depth; d++) { newdata[(y * newWidth + x) * depth + d] = data[((int)(y * scale_y) * width + (int)(x * scale_x)) * depth + d]; } } } ///////// End Image Processing //////////////// |
[기하_축소(평균값필터링)] 메뉴를 더블클릭한 후 다음코드를 완성한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
///////// Start Image Processing //////////////// double scale_x = 2; //scale_x 는 1 이상의 정수 값일 경우만 가능 double scale_y = 2; //scale_y 는 1 이상의 정수 값일 경우만 가능 int width = bmp.Width; int height = bmp.Height; int depth = data.Length / width / height; int newWidth = (int)(bmp.Width / scale_x); int newHeight = (int)(bmp.Height / scale_y); byte[] newdata = new byte[newWidth * newHeight * depth]; for (int y = 0; y < newHeight; y++) { for (int x = 0; x < newWidth; x++) { // 필터 윈도우 내의 픽셀값 합계 계산 int sum = 0; for (int yy = 0; yy < scale_y; yy++) { for (int xx = 0; xx < scale_x; xx++) { if (x * scale_x + xx > width - 1 || y * scale_y + yy > height - 1) { sum += data[(int)(y * scale_y) * width + (int)(x * scale_x); } else { sum += data[(int)(y * scale_y + yy) * width + (int)(x * scale_x + xx)]; } } } sum = (int)(sum / (scale_x * scale_y)); // 평균값 계산 if (sum > 255) sum = 255; if (sum < 0) sum = 0; newdata[(y * newWidth + x) * depth + d] = (byte)sum; } } ///////// End Image Processing //////////////// |
[기하_회전(0. 전방향사상)] 메뉴를 더블클릭한 후 그 위쪽에 2개의 함수를 추가한다. f_MatrixRotate(radian, x, y) : 좌표 (x.… Continue Reading 기하학적 처리 C# 소스 코드
이진 파일 쓰기
1 2 3 4 |
FileStream fs = new FileStream("d:\\aaaa.raw", FileMode.Create, FileAccess.Write); BinaryWriter bw = new BinaryWriter(fs); bw.Write(a); bw.Close(); |
이진 파일 읽기
1 2 3 4 |
FileStream fs = new FileStream("d:\\aaaa.raw", FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); byte[] data = br.ReadBytes(65536); br.Close(); |
이 장에서 배우는 기능 모양중심 설정하기 : 스프라이트의 중심을 변경하는 것 블록 익히기 Wizard, Bat1, Sun을 이용하여 프로젝트 만들기 Wizard 스크립트 : 없음 Bat1 스크립트 0.5초 간격으로 다른 모양으로 바꿈기 Up, Down, Left, Right 키를 누르면 해당 방향으로 10만큼 이동 Sun 스크립트 스페이스 키를 누르면 Wizard 위치로부터 Bat위치로 5만큼 연속… Continue Reading 다트 게임