Bump
|
Hello,
I've seen some people releasing interfaces with this darker small frame on them.
Does anyone have the sprites to compose these frames?
Bump
Trick question, they're not sprites.
Code:public static void fillRectangle(int drawX, int drawY, int width, int height, int colour, int alpha) { if (drawX < clipLeft) { width -= clipLeft - drawX; drawX = clipLeft; } if (drawY < clipTop) { height -= clipTop - drawY; drawY = clipTop; } if (drawX + width > clipRight) width = clipRight - drawX; if (drawY + height > clipBottom) height = clipBottom - drawY; int inverseAlpha = 256 - alpha; int r = (colour >> 16 & 0xff) * alpha; int g = (colour >> 8 & 0xff) * alpha; int b = (colour & 0xff) * alpha; int dx = Raster.width - width; int pixel = drawX + drawY * Raster.width; for (int x = 0; x < height; x++) { for (int y = -width; y < 0; y++) { int r2 = (raster[pixel] >> 16 & 0xff) * inverseAlpha; int g2 = (raster[pixel] >> 8 & 0xff) * inverseAlpha; int b2 = (raster[pixel] & 0xff) * inverseAlpha; raster[pixel++] = (r + r2 >> 8 << 16) + (g + g2 >> 8 << 8) + (b + b2 >> 8); } pixel += dx; } }
thats true i didnt think of that, but still could use it for scaling different sprites if he wants to use some other ones
This is really helpful if I want to step up my interface game. I will use this. Thank you!
I haven’t thought of it as being just code, because people were releasing interfaces with these frames already on them, which I think is weird when you can just use a small snippet.
Exactly!
Greg is still technically right you can define a new widget type u can use for these rectangles, but 9 patch really is helpful for unlimited sizes
If your talking about having them already on the background sprite then they most likely use photoshop. But using lots of large sprites will increase client ram usage significantly, especially as 317 client's hold interfaces and sprites in ram at all times. Backgrounds are tillable and should be drawn using 9-patch like Expanded said, the single colour rectangles should be drawn using the rectangle methods (in all raster classes) one larger filled rectangle and an outline rectangle 2 pixels smaller will get the look you're looking for.
Okay, that’s useful information, I’ll try to use as few images as possible. Some days ago I did a tutorial for only loading sprites when they’re needed. I don’t think they’re unloaded when you’re not using them anymore, but this should cut quite some usage. So that’s always nice to have
Verzonden vanaf mijn iPhone met Tapatalk
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |