I have question about JUCE "Graphics" class and "Component"

Hi !

Please, help me to know:

Image class contains HDC and HBITMAP.
LowLevelGraphicsSoftwareRenderer contains Image& reference.
“Graphics”-class contains LowLevelGraphicsContext* const context; reference.

All buttons, labels etc derived from class “Component”.
I think, all these, derived from Component must contains pointer to Graphics,
but I can’t find where it is writed.

  1. Who send to Component-derived classes pointer to Graphics* object ?
  2. Whether each component contains the your own Graphics object ? (i.e. all Button, Label etc contains your own copy of Graphics)

thanks

http://www.rawmaterialsoftware.com/juce/api/classComponent.html#a7cf1862f4af5909ea72827898114a182

it’s not answer,

I need to understand:

  1. Who send to Component-derived classes pointer to Graphics* object ?
  2. Whether each component contains the your own Graphics object ? (i.e. all Button, Label etc contains your own copy of Graphics)

yeah, it is.

Component::paint(Graphics& g)

the component is given a Graphics to draw itself to inside the ‘paint’ function.

There are probably a thousand examples of paint() routines in the codebase, try having a look at some of them.

Ok, I almost understand…
Whether it means that each component has your own copy of Graphics and your own copy of LowLevelGraphicsSoftwareRenderer ?

And next:
Can was make immediately a raster “Top-down” (by setup bitmapInfo.bV4Height = -h; ?)
jassert (format_ == RGB || format_ == ARGB);

    pixelStride = (format_ == RGB) ? 3 : 4;

    zerostruct (bitmapInfo);
    bitmapInfo.bV4Size = sizeof (BITMAPV4HEADER);
    bitmapInfo.bV4Width = w;
    bitmapInfo.bV4Height = h; //setup = -h;
    bitmapInfo.bV4Planes = 1;
    bitmapInfo.bV4BitCount = (unsigned short) (pixelStride * 8);

    if (format_ == ARGB)
    {
        bitmapInfo.bV4AlphaMask        = 0xff000000;
        bitmapInfo.bV4RedMask          = 0xff0000;
        bitmapInfo.bV4GreenMask        = 0xff00;
        bitmapInfo.bV4BlueMask         = 0xff;
        bitmapInfo.bV4V4Compression    = BI_BITFIELDS;
    }
    else
    {
        bitmapInfo.bV4V4Compression    = BI_RGB;
    }

    lineStride = -((w * pixelStride + 3) & ~3);

Why not just use juce::Image instead, lock the pixels for writing, and have at it?

No, I talk about this code in the Image class.