锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久成人国产精品,久久天天躁狠狠躁夜夜avapp,久久综合狠狠综合久久http://www.shnenglu.com/izualzhy/category/20414.html鍧氭寔 鐩鎬俊鑷繁zh-cnSat, 09 Mar 2013 17:48:49 GMTSat, 09 Mar 2013 17:48:49 GMT60- BMP鏍煎紡瀛︿範涔嬭漿鎹mp涓哄瓧絎︾敾http://www.shnenglu.com/izualzhy/archive/2013/03/09/198322.htmlizualzhyizualzhySat, 09 Mar 2013 15:38:00 GMThttp://www.shnenglu.com/izualzhy/archive/2013/03/09/198322.htmlhttp://www.shnenglu.com/izualzhy/comments/198322.htmlhttp://www.shnenglu.com/izualzhy/archive/2013/03/09/198322.html#Feedback0http://www.shnenglu.com/izualzhy/comments/commentRss/198322.htmlhttp://www.shnenglu.com/izualzhy/services/trackbacks/198322.html浜庢槸璇曠潃鑷繁鍐欎簡涓紝鏁堟灉涓鑸絾鏄緢鏈夋剰鎬濄傜敱浜庢垜浣跨敤鐨勬槸256鑹茬殑bmp錛屽彲鑳戒嬌鐢?4浣嶆垨鑰卝pg鏁堟灉浼氭洿濂戒簺銆?br />鍏堢湅涓嬭漿鎹㈢殑緇撴灉銆?br />杞崲鍓嶏細

杞崲鐨勫瓧絎︾敾錛?br />
緇撴灉姣旇緝綺楃硻錛屼絾榪樺彲浠ユ帴鍙楋紝鎴戞兂濡傛灉鏄?4浣峛mp浼氬ソ寰堝銆傛湁鏃墮棿鐨勮瘽琛ュ厖涓涓嬨?br />榪欓噷鏄唬鐮侊細
1 /* 2 * =====================================================================================
3 * Filename: ConvertBmpToAscii.cpp
4 * Description: convert a 256bmp file to ascii-file
5 *
6 * Version: 1.0
7 * Created: 03/09/2013 05:46:16 PM
8 *
9 * Author: zhy (), izualzhy@163.com
10 * =====================================================================================
11 */
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <string.h>
15 #include "Defs.h"
16
17 int GetGrayFromRGB(RGBQuad color)
18 {
19 return color.rgbRed*0.299 + color.rgbGreen*0.587 + color.rgbBlue*0.114;
20 }
21
22 char GetCharFromGray(int gray)
23 {
24 if (gray > 0.9 && gray <=1.0)
25 {
26 return '#';
27 } else if (gray > 0.7) {
28 return '@';
29 } else if (gray > 0.4) {
30 return '~';
31 } else if (gray > 0.2) {
32 return '\'';
33 } else {
34 return ' ';
35 }
36 }
37
38 int main(int argc, char* argv[])
39 {
40 if (argc < 2)
41 return -1;
42
43 FILE* fp = fopen(argv[1], "r");
44 if (!fp)
45 return -1;
46
47 BitMapFileHeader bmfHeader;
48 fread(&bmfHeader, sizeof(bmfHeader), 1, fp);
49
50 BitMapInfoHeader bmiHeader;
51 fread(&bmiHeader, sizeof(bmiHeader), 1, fp);
52
53 RGBQuad colorTable[256];
54 fread(colorTable, sizeof(RGBQuad), 256, fp);
55
56 int width = bmiHeader.biWidth;
57 width = (width*bmiHeader.biBitCount + 31)/8;
58 width = width/4*4;
59 int height = bmiHeader.biHeight;
60
61 unsigned char* dataImage = (unsigned char*)malloc(width*height*sizeof(unsigned char));
62 memset(dataImage, 0, width*height);
63 fread(dataImage, 1, width*height, fp);
64 char* dataAscii = (char*)malloc(width*height*sizeof(char));
65 memset(dataAscii, ' ', width*height);
66 for (int i=0; i<width; ++i)
67 for (int j=height-1; j>=0; --j)
68 {
69 int gray = GetGrayFromRGB(colorTable[dataImage[j*width + i]]);
70 dataAscii[(height - 1 - j)*width + i] = GetCharFromGray(gray);
71 }
72
73 fclose(fp);
74
75 fp = fopen("demo.txt", "w");
76 if (!fp)
77 return -1;
78
79 for (int j=0; j<height; j+=10)
80 {
81 for (int i=0; i<width; i+=10)
82 {
83 fwrite(dataAscii + j*width + i, 1, 1, fp);
84 }
85 fwrite("\n", 1, sizeof("\n"), fp);
86 }
87 fclose(fp);
88 free(dataImage);
89 free(dataAscii);
90
91 return 0;
92 }
93

]]> - BMP鏍煎紡瀛︿範涔嬪垱寤篵mp鏂囦歡http://www.shnenglu.com/izualzhy/archive/2013/03/09/198317.htmlizualzhyizualzhySat, 09 Mar 2013 09:22:00 GMThttp://www.shnenglu.com/izualzhy/archive/2013/03/09/198317.htmlhttp://www.shnenglu.com/izualzhy/comments/198317.htmlhttp://www.shnenglu.com/izualzhy/archive/2013/03/09/198317.html#Feedback0http://www.shnenglu.com/izualzhy/comments/commentRss/198317.htmlhttp://www.shnenglu.com/izualzhy/services/trackbacks/198317.html鎺ヤ笂綃囷紝鏃㈢劧棰滆壊琛ㄥ彲浠ュ緱鍒幫紝bmp鐨勬枃浠舵牸寮忓凡緇忓緢娓呮浜嗭紝鑳藉惁鑷繁鍒涘緩bmp鏂囦歡鍛紵
榪樻槸浠?56鑹瞓mp涓轟緥.
絳旀鏄彲浠ョ殑錛岃繖鏄▼搴忕敓鎴愮殑涓涓畝鍗曠殑bmp錛?/p>

鏍規(guī)嵁涔嬪墠鐨勯鑹茶〃錛屽彲浠ュ緱鍒皉ed,green,blue鍍忕礌瀵瑰簲鐨刬ndex,鍙鍦ㄤ綅鍥炬暟鎹尯鍐欎笂璇ュ唴瀹瑰氨濂戒簡銆?/p>
娉ㄦ剰浣嶅浘鏁版嵁鐨勬柟鍚戞槸浠庡乏鍒板彸浠庝笅鑷充笂銆?/p>
Code Snippet
- /*
- * =====================================================================================
- * Filename: CreateBMPFile.cpp
- * Description: demos of creating 256BMP file
- *
- * Version: 1.0
- * Created: 03/09/2013 03:44:13 PM
- *
- * Author: zhy (), izualzhy@163.com
- * =====================================================================================
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "Defs.h"
-
- int main()
- {
- const int width = 200;
- const int height = 300;
- const int bitCount = 8;
-
- int realWidth = (width * bitCount + 31)/8;
- realWidth = realWidth/4*4;
- const int dataSize = realWidth * height;
-
- BitMapFileHeader bmfHeader;
- memset(&bmfHeader, 0, sizeof(bmfHeader));
- bmfHeader.bfType = 0x4d42;
- bmfHeader.bfOffBits = sizeof(BitMapFileHeader) + sizeof(BitMapInfoHeader) + sizeof(RGBQuad)*256;
- bmfHeader.bfSize = bmfHeader.bfOffBits + dataSize;
-
- BitMapInfoHeader bmiHeader;
- memset(&bmiHeader, 0, sizeof(bmiHeader));
- bmiHeader.biSize = sizeof(BitMapInfoHeader);
- bmiHeader.biWidth = width;
- bmiHeader.biHeight = height;
- bmiHeader.biPlanes = 1;
- bmiHeader.biBitCount = bitCount;
- bmiHeader.biSizeImage = dataSize;
-
- FILE* fpIn = fopen("3.bmp", "r");//3.bmp鏄箣鍓嶆祴璇曠敤鐨勬枃浠訛紝256鑹瞓mp
- if (!fpIn)
- return -1;
-
- RGBQuad colorTables[256];
- fseek(fpIn, 0x36, SEEK_SET);
- fread(colorTables, sizeof(RGBQuad), 256, fpIn);
- fclose(fpIn);
-
- unsigned char* imageData = (unsigned char*)malloc(dataSize*sizeof(unsigned char));
- if (!imageData)
- return -1;
-
- memset(imageData, 0, dataSize);
- for (int i=0; i<realWidth; ++i)
- {
- for (int j=0; j<=20; ++j)
- {
- imageData[j*realWidth + i] = 0xff;//white
- }
-
- for (int j=50; j<=100; ++j)
- {
- imageData[j*realWidth + i] = 0xfc;//blue
- }
-
- for (int j=150; j<=180; ++j)
- {
- imageData[j*realWidth + i] = 0xfa;//green
- }
-
- for (int j=220; j<300; ++j)
- {
- imageData[j*realWidth + i] = 0xf9;//red
- }
- }
-
- FILE* fpOut = fopen("demo.bmp", "w");
- if (!fpOut)
- return -1;
-
- fwrite(&bmfHeader, sizeof(bmfHeader), 1, fpOut);
- fwrite(&bmiHeader, sizeof(bmiHeader), 1, fpOut);
- fwrite(colorTables, sizeof(RGBQuad), 256, fpOut);
- fwrite(imageData, 1, dataSize, fpOut);
- fclose(fpOut);
free(imageData); - }
璇ヤ唬鐮佷細鐢熸垚涓婅堪bmp鏂囦歡銆?/p>
濡傛灉浣犵湅浜嗗墠闈㈢殑鏂囩珷錛屽氨鍒棶鎴?.bmp鍝噷鐨刕_^
鍥犱負鏁版嵁鏂瑰悜浠庝笂鍒頒笅錛屽洜姝や粠涓嬪埌涓婁緷嬈′負white, blue, green, red銆?/p>
鏃㈢劧鏁版嵁鍙互榪欎箞鍐欏叆錛屾帴涓嬫潵鐨勫氨鍙互鑷繁鐜╁暒銆?/p>
姣斿鍐欏叆鐨勪唬鐮佹敼鎴愪簡榪欎釜鏍峰瓙錛?/p>
Code Snippet
- int i = 0;
- while (i++ < 100)
- {
- int randX = rand()%realWidth;
- int randY = rand()%height;
- int randColorIndex = rand()%256;
- const int range = 15;
-
- int minX = randX - range;
- minX = minX > 0 ? minX : 0;
- int minY = randY - range;
- minY = minY > 0 ? minY : 0;
- int maxX = randX + range;
- maxX = maxX > realWidth ? realWidth : maxX;
- int maxY = randY + range;
- maxY = maxY > height ? height : maxY;
-
- printf("%d,%d,%d,%d\n",minX, maxX, minY, maxY);
- for (int i=minX; i<maxX; ++i)
- for (int j=minY; j<maxY; ++j)
- {
- imageData[j*realWidth + i] = randColorIndex;
- }
- }
闅忔満鍙栫偣錛屼互璇ョ偣涓轟腑蹇冪殑鐭╁艦闅忔満濉厖棰滆壊銆傚氨鎴愪簡榪欎釜鏍峰瓙錛?/p>

鏄笉鏄緢濂界帺錛熺粯鍒剁洿綰匡紝鍦嗗艦搴旇灝卞緢瀹規(guī)槗浜嗐?/p>
]]>- BMP鏍煎紡瀛︿範涔嬫彁鍙栭鑹茶〃http://www.shnenglu.com/izualzhy/archive/2013/03/09/198315.htmlizualzhyizualzhySat, 09 Mar 2013 07:52:00 GMThttp://www.shnenglu.com/izualzhy/archive/2013/03/09/198315.htmlhttp://www.shnenglu.com/izualzhy/comments/198315.htmlhttp://www.shnenglu.com/izualzhy/archive/2013/03/09/198315.html#Feedback0http://www.shnenglu.com/izualzhy/comments/commentRss/198315.htmlhttp://www.shnenglu.com/izualzhy/services/trackbacks/198315.html鎸夌収浠庣綉涓婃煡鎵劇殑璧勬枡bmp鏍煎紡鐨勯鑹茶〃鏄笉鍥哄畾鐨勶紝鐨勭‘濡傛錛屾垜嫻嬭瘯浜嗗嚑涓猙mp錛岄鑹茶〃鍚勪笉鐩稿悓銆?/p>
涓嶈繃鐢眞indows鐢誨浘紼嬪簭鐢熸垚鐨?56鑹茬殑bmp璇曢獙鏃訛紝鍙戠幇棰滆壊琛ㄤ竴鐩寸浉鍚岋紝鐢ㄦ潵浣滀負鑷繁鐢熸垚bmp鏂囦歡鐨勯鑹茶〃妯$増涓嶉敊銆?/p>
浠g爜錛?/p>
Code Snippet
- /*
- * =====================================================================================
- * Filename: PrintColorTable.cpp
- * Description: Print ColorTable Of Bmp Files
- *
- * Version: 1.0
- * Created: 03/09/2013 02:56:28 PM
- *
- * Author: zhy (), izualzhy@163.com
- * =====================================================================================
- */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include "Defs.h"
- using namespace std;
-
- int main(int argc, char* argv[])
- {
- if (argc < 2)
- return -1;
-
- FILE* fp = fopen(argv[1], "r");
- if (!fp)
- return -1;
-
- BitMapFileHeader bmfHeader;
- fread(&bmfHeader, sizeof(bmfHeader), 1, fp);
-
- BitMapInfoHeader bmiHeader;
- fread(&bmiHeader, sizeof(bmiHeader), 1, fp);
-
- RGBQuad* colorTable = NULL;
- const int tableCount = pow(2, bmiHeader.biBitCount);
- switch (bmiHeader.biBitCount)
- {
- case 1:
- case 4:
- case 8:
- colorTable = (RGBQuad*)malloc(tableCount*sizeof(RGBQuad));
- break;
- case 24:
- //no colorTable;
- printf("No ColorTable For 24bits-bmp\n");
- return 0;
- default:
- printf("unrecoginzed bitsCount\n");
- return 0;
- }
-
- if (!colorTable)
- {
- printf("malloc error!\n");
- return -1;
- }
-
- fread(colorTable, sizeof(RGBQuad), tableCount, fp);
- for (int i=0; i<tableCount; ++i)
- {
- printf("%02x %02x %02x %02x\n", colorTable[i].rgbBlue, colorTable[i].rgbGreen, colorTable[i].rgbRed, colorTable[i].rgbReserved);
- }
- free(colorTable);
- return 0;
- }
鍙互鐢ㄦ潵鎵撳嵃鍗曡壊浣嶅浘錛?6鑹蹭綅鍥撅紝256鑹蹭綅鍥劇殑棰滆壊琛紝榪涗竴姝ユ瘮杈冪浉鍚屼綅涓嶅悓bmp鐨勯鑹茶〃鐨勫尯鍒?/p>
]]>
青青热久久国产久精品|
亚洲精品第一综合99久久|
久久夜色精品国产噜噜噜亚洲AV
|
伊人久久综合无码成人网|
香蕉久久夜色精品国产尤物|
无码伊人66久久大杳蕉网站谷歌|
久久久久久国产精品无码超碰|
日本三级久久网|
伊人情人综合成人久久网小说|
久久天天躁狠狠躁夜夜网站|
国产精品久久久久乳精品爆|
亚洲va久久久噜噜噜久久狠狠|
日本免费一区二区久久人人澡|
国产69精品久久久久观看软件|
久久精品国产69国产精品亚洲|
婷婷久久综合|
国产午夜福利精品久久|
久久精品aⅴ无码中文字字幕重口
久久精品a亚洲国产v高清不卡
|
久久午夜免费视频|
91麻精品国产91久久久久|
亚洲AV无码久久寂寞少妇|
久久精品国产精品亜洲毛片|
久久久久久久97|
性欧美丰满熟妇XXXX性久久久|
日韩中文久久|
久久精品女人天堂AV麻|
青青青青久久精品国产|
久久精品国产亚洲AV电影|
久久综合亚洲色HEZYO社区|
久久乐国产精品亚洲综合|
国产亚州精品女人久久久久久|
2021精品国产综合久久|
精品久久8x国产免费观看|
久久国产亚洲精品无码|
久久精品亚洲日本波多野结衣
|
亚洲国产精品久久66|
国产精品久久久久影院嫩草|
jizzjizz国产精品久久|
亚洲国产精品无码久久|
久久久久久九九99精品|
久久精品国产影库免费看|