[chromium-dev] Re: Creating a SkBitmap filled with one color

2009-08-26 Thread Evan Stade
Use cairo instead of Skia if you can avoid it in gtk code. -- Evan Stade On Wed, Aug 26, 2009 at 4:12 PM, Paweł Hajdan Jr.phajdan...@chromium.org wrote: How do I create a SkBitmap of arbitrary size, filled with color of my choice (on Linux)? I'd need that for Linux extension shelf, and the

[chromium-dev] Re: Creating a SkBitmap filled with one color

2009-08-26 Thread Nico Weber
When I talked with Aaron, he said porting the shelf to OS X isn't something I should tackle unless I'm _really_ running out of things to do, since they're not even sure they're going to keep it. Has this changed, or is the situation different on linux for some reason? Nico On Wed, Aug 26, 2009

[chromium-dev] Re: Creating a SkBitmap filled with one color

2009-08-26 Thread Dean McNamee
To answer the technical (non-political) part of this question. Create a SkBitmap which backs to some pixels. Create a SkCanvas on top of it. Call drawPaint or more directly drawColor. On Wed, Aug 26, 2009 at 4:17 PM, Nico Weber tha...@chromium.org wrote: When I talked with Aaron, he said

[chromium-dev] Re: Creating a SkBitmap filled with one color

2009-08-26 Thread Erik Kay
On Wed, Aug 26, 2009 at 4:17 PM, Nico Webertha...@chromium.org wrote: When I talked with Aaron, he said porting the shelf to OS X isn't something I should tackle unless I'm _really_ running out of things to do, since they're not even sure they're going to keep it. Has this changed, or is the

[chromium-dev] Re: Creating a SkBitmap filled with one color

2009-08-26 Thread Paweł Hajdan Jr .
Thanks for all the answers, especially the first one from erg. I'm going to use Skia, because another method (SetBackground in RWHV) requires that. On Wed, Aug 26, 2009 at 16:33, Tony Chang t...@chromium.org wrote: There's an example of how to do this with skia in src/app/resource_bundle.cc

[chromium-dev] Re: Creating a SkBitmap filled with one color

2009-08-26 Thread Adam Langley
On Wed, Aug 26, 2009 at 4:12 PM, Paweł Hajdan Jr.phajdan...@chromium.org wrote: How do I create a SkBitmap of arbitrary size, filled with color of my choice (on Linux)? Without any testing at all, it would look a little like SkBitmap bitmap; bitmap.setConfig(SkBitmap::kARGB__Config,

[chromium-dev] Re: Creating a SkBitmap filled with one color

2009-08-26 Thread Elliot Glaysher (Chromium)
See what I do in GtkThemeProvider::LoadThemeBitmap: SkBitmap* bitmap = new SkBitmap; bitmap-setConfig(SkBitmap::kARGB__Config, kToolbarImageWidth, kToolbarImageHeight); bitmap-allocPixels(); bitmap-eraseRGB(color-red 8, color-green 8, color-blue 8);

[chromium-dev] Re: Creating a SkBitmap filled with one color

2009-08-26 Thread Dean McNamee
On Wed, Aug 26, 2009 at 4:14 PM, Elliot Glaysher (Chromium) e...@chromium.org wrote: See what I do in GtkThemeProvider::LoadThemeBitmap:    SkBitmap* bitmap = new SkBitmap;    bitmap-setConfig(SkBitmap::kARGB__Config,                      kToolbarImageWidth, kToolbarImageHeight);    

[chromium-dev] Re: Creating a SkBitmap filled with one color

2009-08-26 Thread Tony Chang
There's an example of how to do this with skia in src/app/resource_bundle.cc around line 146. That said, you should use cairo to paint in GTK. On Wed, Aug 26, 2009 at 4:27 PM, Dean McNamee de...@chromium.org wrote: To answer the technical (non-political) part of this question. Create a

[chromium-dev] Re: Creating a SkBitmap filled with one color

2009-08-26 Thread Nico Weber
This code is incorrect, you should divide by 257, not 256.  See the GDK_COLOR_RGB macro. That's not true. GDK_COLOR_RGB multiplies by 257 (= 0x10001) to distribute the bits evenly ( http://www.mindcontrol.org/~hplus/graphics/expand-bits.html ). To get back, you can just shift (or, formulated

[chromium-dev] Re: Creating a SkBitmap filled with one color

2009-08-26 Thread Dean McNamee
Yes, this can be reformulated easier as i * 257 = i * 256 + i and i / 256 will always be zero for i 256. Anyway, I suppose it doesn't matter. The question is what to do for mapping 16-bit back to 8-bit, when it wasn't necessarily originally produced from 8-bit. I suppose that dividing by