˹á
 úҹ
  C/C++ new
  Java new
 Sourcecode.TV
  Android
  Blackberry
  C/C++
  Java
  Linux
  Windows Phone
  ͧͧ
 
  .NET
  Android
  Blackberry
  C++Builder
  Delphi
  Java
  Mobile
  Open Source
  Pocket PC
  Visual Basic
  Web
  Windows Phone
  Others
 Ẻ¹
  ASP
  ASP.NET Webmatrix
  C++
  eVB
  J2ME
  Java
  PHP
 
  Android
  ASP
  C++
  VC++
  CGI-Perl
  Delphi
  Java
  jQuery
  PHP
  Visual Basic
  .NET
 ԡèҡ
  Դ...
  DoodeeHosting
  Ѻ͡Ẻ Ѳ䫵
  Freeware
  ѵҤɳ
  ª١
  ʶԵԼ
 Ŵ
 Ң
 дҹʹ
  .NET
  C/C++
  Delphi
  Java
  Palm/PocketPC
  Visual Basic
  Web
 
 дҹҹ
 ԧ
 ǡѺ
 ѵҤɳ
Social Network

Facebook  Twitter  YouTube
 New Article
 Webboard
 Freelanceboard
Freeware
 (BerDee)
(Android)
駩غ
駩غ(Android)
WebcamMonitor
WebcamMonitor(Windows)
scSendMail
scSendMail(Windows)
MSN Caption
MSN Caption(Windows)
  Freelance comment
  ԴͺʹФѺ...
2015-07-29 13:35:58
  Ҽͧ纷ѲҴ HTML5 ...
2015-01-18 15:33:54
  Ҽͧ纷ѲҴ HTML5 ...
2015-01-18 15:32:51
  ԴͺФѺ
ҹ...

2014-01-06 12:47:38
  ѧҤ͹ ͧ֡ͧ...
2013-07-06 01:04:37
  ʹ觢ͺࢵҤҤҡ͹ФѺ...
2013-03-24 18:54:20
  ѧդѺҹԴѺ 08...
2012-12-16 19:18:14
  ʹ㨤 Դ 0905076277...
2012-11-12 11:07:46
  Ѻ礹ѡ֡ͺѷ
...

2012-10-29 03:10:46
  sukit_te34@hotmail.com...
2012-10-29 03:09:36
  Webboard comment
  ͧ gotoxy ѧ...
2017-08-28 11:45:52
  ͧҧա u...
2017-08-27 20:09:01
  #define GLUT_DISABLE_ATEXIT...
2017-08-27 12:53:17
  դԻ͹ ...
2017-08-27 10:50:02
  Ѻ ͹ matlab ¹ matlab...
2017-06-03 16:27:23
  ੾зҧҴ ͧҢ...
2017-05-25 16:18:08
  ͧ˹Ѻ os ...
2017-05-25 16:12:47
  ¹ php curl ...
2017-04-20 01:04:20
  ¹ ...
2017-03-27 12:50:54
  ʧҷ ͧѾഷ...
2017-03-27 12:37:20
  Homework comment
  ͺسҡѺ...
2017-08-16 18:27:25
  ͧ ͧ ѧ ^^...
2017-04-18 18:40:46
  ͧ ͧ ѧ ^^...
2017-04-18 18:37:54
  á flowchart ѹ...
2017-04-18 17:43:33
  ҡ flowchart ...
2017-04-18 16:25:29
  kungking ӶäѺ ?...
2017-03-18 23:28:36
  ¹ʴͧ...
2017-03-06 10:56:25
  鴷ӧҹẺ ...
2016-09-06 01:00:12
  ҡҺ鴹Ѻѧ...
2016-09-05 09:31:27
  ͧ֡¹...
2016-04-22 00:47:49
  Article comment
  [b]5 ...
2017-10-18 08:19:17
  - ...
2017-10-18 07:17:11
  [b] ...
2017-10-18 06:07:31
  [b] 96 ...
2017-10-18 06:05:28
  - ...
2017-10-18 05:49:56
  code ͧ VB ú...
2017-09-28 16:50:02
  ҨѺ ͧ
...

2017-07-11 09:59:35
  ö͡Ѻ anycast ...
2017-07-05 10:12:35
  Ѻ س "Դ" ͧ֡...
2016-06-18 15:21:09
  vs2008 c# Ѻ ͺسѺ...
2016-06-17 14:39:30
  9Mcode comment
  ҡ...
2014-02-21 08:52:19

Link Exchange

ѵҤɳ
Statistics of Sourcecode in Thailand
 
 Webboard

- - - - - - - - - - - - - - ʹѺʹع- - - - - - - - - - - - - -

з #3350 []

ͤӻ֡ ¹ bitmap鴹

ҡ鴢ҧФ ˹ٷӡá˹ŧշоԡẺ
ѹջѭҵ͹૿Ф WIDTHѺHEIGHT ҡѹҾ͡Ҩջѭ WIDTHѺHEIGHTҡѹ Ҿ૿͡ҾԡŨᵡ èѧ䧴 ͤԴҵçش˹դ ͺس
import java.io.File;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.IOException;


public class BMP {

private final static int BMP_CODE = 19778;//19778;
private static final String filename = "MyImage12.bmp";
private static final int WIDTH = 250;
private static final int HEIGHT = 200;
static int[][] rgbValues=new int [WIDTH][HEIGHT];




byte [] bytes;
public static void main(String[] args) {



int x = (int) (Math.random() * WIDTH);
int y =(int) (Math.random() * HEIGHT);
int r = ( int ) ( Math.random() * 256 );
int b = ( int ) ( Math.random() * 256 );
int g =( int ) ( Math.random() * 256 );
int alpha=( int ) ( Math.random() * 256 );
rgbValues[x][y]=r|g<<8|b<<16;
System.out.println("[x][y]="+x+","+y);
//System.out.println("rgb="+r+","+b+","+g);

int x_m=x;
int y_m=y;
//System.out.println("[xm1][ym1]="+x_m+","+y_m);
for(int q=1;q<100;q++){

//System.out.println("[xm1][ym1]="+l+","+x+","+y);
int nx=x-q;
int ny=y-q;
rgbValues[nx][ny]=r|g<<8|b<<16;


System.out.println(nx+","+ny);

}








new BMP().saveBMP(filename,rgbValues);

//int red, green, blue;



}



public void saveBMP(String filename, int [][] rgbValues){

try {

FileOutputStream fos = new FileOutputStream(new File(filename));



bytes = new byte[54 + 3*rgbValues.length*rgbValues[0].length + getPadding(rgbValues[0].length)*rgbValues.length];


saveFileHeader();

saveInfoHeader(rgbValues.length, rgbValues[0].length);

saveRgbQuad();

saveBitmapData(rgbValues);


fos.write(bytes);



fos.close();



} catch (FileNotFoundException e) {



} catch (IOException e) {



}



}


private void saveFileHeader() {

byte[]a=intToByteCouple(BMP_CODE);

bytes[0]=a[1];

bytes[1]=a[0];



a=intToFourBytes(bytes.length);

bytes[5]=a[0];

bytes[4]=a[1];

bytes[3]=a[2];

bytes[2]=a[3];



//data offset

bytes[10]=54;

}



private void saveInfoHeader(int height, int width) {

bytes[14]=40;



byte[]a=intToFourBytes(width);

bytes[22]=a[3];

bytes[23]=a[2];

bytes[24]=a[1];

bytes[25]=a[0];



a=intToFourBytes(height);

bytes[18]=a[3];

bytes[19]=a[2];

bytes[20]=a[1];

bytes[21]=a[0];



bytes[26]=1;



bytes[28]=24;

}



private void saveRgbQuad() {



}


private void saveBitmapData(int[][]rgbValues) {

int i;



for(i=0;i<rgbValues.length;i++){

writeLine(i, rgbValues);

}



}



private void writeLine(int row, int [][] rgbValues) {

final int offset=54;

final int rowLength=rgbValues[row].length;

final int padding = getPadding(rgbValues[0].length);

int i;



for(i=0;i<rowLength;i++){

int rgb=rgbValues[row][i];

int temp=offset + 3*(i+rowLength*row) + row*padding;



bytes[temp] = (byte) (rgb>>16);

bytes[temp +1] = (byte) (rgb>>8);

bytes[temp +2] = (byte) rgb;

}

i--;

int temp=offset + 3*(i+rowLength*row) + row*padding+3;



for(int j=0;j<padding;j++)

bytes[temp +j]=0;



}


private byte[] intToByteCouple(int x){

byte [] array = new byte[2];



array[1]=(byte) x;

array[0]=(byte) (x>>8);



return array;

}



private byte[] intToFourBytes(int x){

byte [] array = new byte[4];



array[3]=(byte) x;

array[2]=(byte) (x>>8);

array[1]=(byte) (x>>16);

array[0]=(byte) (x>>24);



return array;

}



private int getPadding(int rowLength){



int padding = (3*rowLength)%4;

if(padding!=0)

padding=4-padding;





return padding;

}



}
ҡس : erapun [2012-09-28 21:55:42]  

101.108.213.93 Դ #28689 (ҡ IP: 101.108.213.93)
ҴҾ save ǢҴ width*height ҡѺ˹ҤѺ
鴷ӧҹѧԴ
ҢҴç ͧ鴷ǹҤӵͺ (ǹ Ƿ)
ҡس : [2012-09-29 01:42:52]
ͺз
´

- - - - - - - - - - - - - - ʹѺʹع- - - - - - - - - - - - - -

 
 
µͨ Ѻͧ macbook pro 2016 (usb-c to HDMI)
µͨ Ѻͧ macbook pro 2016 (usb-c to HDMI) ´дѺ 4K
ŧ Mini DisplayPort to HDMI Adapter ŧ Mini DisplayPort to HDMI Adapter Ѻͧ macbook air/pro, mac mini
ŧ Mini DisplayPort to HDMI Adapter Ѻͧ macbook air/pro, mac mini
µٿѧ Ъ Ѻ iPhone 7  7 Plus
µٿѧ Ъ Ѻ iPhone 7 7 Plus
ŧҡ USB-C Type  USB 3.1 Ѻ MacBook
ŧҡ USB-C Type USB 3.1 Ѻ MacBook
䢤ǧѺͧ Macbook Air/Pro
䢤ǧ Ѻͧ Macbook Air/Pro (300ҷ)
HDMI  3 ͡  1
HDMI 3 ͡ 1 (350ҷ)
Ի͹¹
¹¹ͷ
¹¹͹´
¹¹
¹¹ վʾ
¹¹
¹ҹԹء
¹¹Թ⿹
¹¹Ϊ ʤ
9M Blog ͧ͡ ¹ͧ
ԡ ҾѺԭ
OrmSin.com: ˹ѧͧҹ--չ (country crafts)
ѵҤɳ
 
Tutorial
eVB Tutorial
ASP.NET Webmatrix Tutorial
J2ME Tutorial
C++  Tutorial
Java  Tutorial
PHP Tutorial
ASP Tutorial
 
ẺǨ
Freelance ѺѲ

Home - Article - Tutorial - Sourcecode - Dev Handbook - Search - WebBoard - Links - About Us

ʧǹԢԷ Ѵ͡ ӫ Ѵŧ ٻẺ Ѻ͹حҵѡɳѡ
Ţ¹ҳԪ硷͹ԡҡзǧҳԪ: 7100503002000
Copyright 2001 SourceCode.in.th