how do you read a few pixels from an image.. October 30, 2012 04:09PM | Registered: 12 years ago Posts: 110 |
Re: how do you read a few pixels from an image.. November 19, 2012 02:19PM | Registered: 12 years ago Posts: 110 |
Re: how do you read a few pixels from an image.. November 21, 2012 09:50AM | Registered: 13 years ago Posts: 58 |
unsigned char* pImage = DecodePNG(...whatever arguments needed...); // get block in row 12, column 13 int xb = 13; int yb = 12; unsigned char* pBlock = GetBlockAt(xb, yb, pImage); ... unsigned char* GetBlockAt(int xb, int yb, unsigned char* pImage) { const int imageSizeX = 256; const int blockSizeX = 16; const int blockSizeY = 16; return pImage + ((blockSizeY * yb * imageSizeX) + (blockSizeX * xb) * 4; }
Re: how do you read a few pixels from an image.. November 23, 2012 10:24PM | Registered: 12 years ago Posts: 110 |
Re: how do you read a few pixels from an image.. November 23, 2012 11:00PM | Registered: 12 years ago Posts: 110 |
GRRLIB_DrawImg(250, 48, terrain, 0, 1/*X*/, 1/*Y*/, 0xffffffff); //Scale x multiplies the width by x, same for y. 1 for scale leaves the image at original size.So i want's to change the 1, 1 codinaters to show only one block not the whole terrain.png file.
Re: how do you read a few pixels from an image.. November 24, 2012 11:09AM | Registered: 15 years ago Posts: 384 |
Quote
filfat
EDIT2: I realy dont get the GX part!!! any easy 3D/2D libs with Doc best was if it has a video tut. for I realy sucks at GX part -_-
Re: how do you read a few pixels from an image.. November 24, 2012 12:13PM | Registered: 12 years ago Posts: 110 |
Re: how do you read a few pixels from an image.. November 24, 2012 12:51PM | Registered: 12 years ago Posts: 110 |
Re: how do you read a few pixels from an image.. November 24, 2012 01:03PM | Registered: 12 years ago Posts: 110 |
> "make" main.cpp c:/Users/Filiph/wiicraft-code/source/main.cpp: In function 'int SDL_main()': c:/Users/Filiph/wiicraft-code/source/main.cpp:179:9: warning: unused variable 'version' [-Wunused-variable] c:/Users/Filiph/wiicraft-code/source/main.cpp:180:6: warning: unused variable 'xb' [-Wunused-variable] c:/Users/Filiph/wiicraft-code/source/main.cpp:181:9: warning: unused variable 'yb' [-Wunused-variable] linking ... wiicraft-code.elf c:/devkitPro/libogc/lib/wii\libgrrlib.a(GRRLIB_core.o):(.sbss.xfb+0x0): multiple definition of `xfb' c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wiivideo.o):c:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/video/wii/SDL_wiivideo.c:279: first defined here c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wii_main.o): In function `main': c:\Users\Daryl\Desktop\Projects\sdl-wii\SDL/src/main/wii/SDL_wii_main.c:78: undefined reference to `SDL_main' c:/devkitPro/libogc/lib/wii\libSDL.a(SDL_wiivideo.o): In function `WII_InitVideoSystem': SDL_wiivideo.c:(.text.WII_InitVideoSystem+0x42): undefined reference to `TVPal574IntDfScale' SDL_wiivideo.c:(.text.WII_InitVideoSystem+0x4a): undefined reference to `TVPal574IntDfScale' collect2: ld returned 1 exit status make[1]: *** [/c/Users/Filiph/wiicraft-code/wiicraft-code.elf] Error 1 "make": *** [build] Error 2 > Process Exit Code: 2 > Time Taken: 00:03
Re: how do you read a few pixels from an image.. November 24, 2012 05:25PM | Registered: 15 years ago Posts: 384 |
Re: how do you read a few pixels from an image.. December 06, 2012 09:07AM | Registered: 11 years ago Posts: 1 |
That's a perfectly nice 16 by 16 texture palette, just draw quads (or two triangles) with the right texture coordinates.Quote
filfat
how to read one singel block in this image?
texture = GRRLIB_LoadTextureFromFile (filename); GRRLIB_InitTileSet (texture, 16, 16, 0); GRRLIB_DrawTileQuad (theQuad, texture, color, frame);I wonder why GRRLIB doesn't load textures in the Wii's native format as produced by gxtexconv. (There's no reason to convert from PNG to GX native texture format on every load instead of once when building)
Re: how do you read a few pixels from an image.. December 06, 2012 12:04PM | Registered: 13 years ago Posts: 58 |
Re: how do you read a few pixels from an image.. December 07, 2012 10:55PM | Registered: 12 years ago Posts: 110 |