diff options
| author | Manolo Gouy <Manolo> | 2018-03-22 16:38:38 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-03-22 16:38:38 +0000 |
| commit | 9f9631e6856f56d9439ae5f91ed94dda0f19b568 (patch) | |
| tree | 9a7be15f89cf25588f6ebd4e27a7fcd5ea47f8d8 /src/drivers | |
| parent | 0b8116ff72145816c3e1d4909038c126327e7bf2 (diff) | |
Rename Fl_Image::pixel_w() and pixel_h() to Fl_Image::data_w() and data_h().
The docs of class Fl_Image and of Fl_Image::scale() are beefed up.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12784 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx | 30 | ||||
| -rw-r--r-- | src/drivers/PostScript/Fl_PostScript_image.cxx | 12 | ||||
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx | 12 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx | 22 |
4 files changed, 38 insertions, 38 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx index 349775aad..5c00198f0 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx @@ -463,7 +463,7 @@ void Fl_GDI_Printer_Graphics_Driver::draw_unscaled(Fl_Bitmap *bm, float s, int X fl_end_offscreen(); // offscreen data is in tmp_id SelectObject(tempdc, (HGDIOBJ)tmp_id); // use offscreen data // draw it to printer context with background color as transparent - fl_TransparentBlt(gc_, X,Y,W,H, tempdc, cx, cy, bm->pixel_w(), bm->pixel_h(), RGB(r, g, b) ); + fl_TransparentBlt(gc_, X,Y,W,H, tempdc, cx, cy, bm->data_w(), bm->data_h(), RGB(r, g, b) ); fl_delete_offscreen(tmp_id); RestoreDC(tempdc, save); DeleteDC(tempdc); @@ -472,14 +472,14 @@ void Fl_GDI_Printer_Graphics_Driver::draw_unscaled(Fl_Bitmap *bm, float s, int X static Fl_Offscreen build_id(Fl_RGB_Image *img, void **pmask) { - Fl_Image_Surface *surface = new Fl_Image_Surface(img->pixel_w(), img->pixel_h()); + Fl_Image_Surface *surface = new Fl_Image_Surface(img->data_w(), img->data_h()); Fl_Surface_Device::push_current(surface); if ((img->d() == 2 || img->d() == 4) && fl_can_do_alpha_blending()) { - fl_draw_image(img->array, 0, 0, img->pixel_w(), img->pixel_h(), img->d()|FL_IMAGE_WITH_ALPHA, img->ld()); + fl_draw_image(img->array, 0, 0, img->data_w(), img->data_h(), img->d()|FL_IMAGE_WITH_ALPHA, img->ld()); } else { - fl_draw_image(img->array, 0, 0, img->pixel_w(), img->pixel_h(), img->d(), img->ld()); + fl_draw_image(img->array, 0, 0, img->data_w(), img->data_h(), img->d(), img->ld()); if (img->d() == 2 || img->d() == 4) { - *pmask = fl_create_alphamask(img->pixel_w(), img->pixel_h(), img->d(), img->ld(), img->array); + *pmask = fl_create_alphamask(img->data_w(), img->data_h(), img->d(), img->ld(), img->array); } } Fl_Surface_Device::pop_current(); @@ -494,8 +494,8 @@ void Fl_GDI_Graphics_Driver::draw_unscaled(Fl_RGB_Image *img, float s, int X, in Y = Y*s; cache_size(img, W, H); cx *= s; cy *= s; - if (W + cx > img->pixel_w()) W = img->pixel_w() - cx; - if (H + cy > img->pixel_h()) H = img->pixel_h() - cy; + if (W + cx > img->data_w()) W = img->data_w() - cx; + if (H + cy > img->data_h()) H = img->data_h() - cy; if (!*Fl_Graphics_Driver::id(img)) { *Fl_Graphics_Driver::id(img) = (fl_uintptr_t)build_id(img, (void**)(Fl_Graphics_Driver::mask(img))); *cache_scale(img) = 1; @@ -521,13 +521,13 @@ void Fl_GDI_Graphics_Driver::draw_unscaled(Fl_RGB_Image *img, float s, int X, in int Fl_GDI_Printer_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, int WP, int HP) { XFORM old_tr, tr; GetWorldTransform(gc_, &old_tr); // storing old transform - tr.eM11 = float(WP)/float(img->pixel_w()); - tr.eM22 = float(HP)/float(img->pixel_h()); + tr.eM11 = float(WP)/float(img->data_w()); + tr.eM22 = float(HP)/float(img->data_h()); tr.eM12 = tr.eM21 = 0; tr.eDx = float(XP); tr.eDy = float(YP); ModifyWorldTransform(gc_, &tr, MWT_LEFTMULTIPLY); - img->draw(0, 0, img->pixel_w(), img->pixel_h(), 0, 0); + img->draw(0, 0, img->data_w(), img->data_h(), 0, 0); SetWorldTransform(gc_, &old_tr); return 1; } @@ -548,10 +548,10 @@ int Fl_GDI_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, int WP, i int save = SaveDC(new_gc); SelectObject(new_gc, (HBITMAP)*Fl_Graphics_Driver::id(rgb)); if ( (rgb->d() % 2) == 0 ) { - alpha_blend_(XP*scale_, YP*scale_, WP, HP, new_gc, 0, 0, rgb->pixel_w(), rgb->pixel_h()); + alpha_blend_(XP*scale_, YP*scale_, WP, HP, new_gc, 0, 0, rgb->data_w(), rgb->data_h()); } else { SetStretchBltMode(gc_, HALFTONE); - StretchBlt(gc_, XP*scale_, YP*scale_, WP, HP, new_gc, 0, 0, rgb->pixel_w(), rgb->pixel_h(), SRCCOPY); + StretchBlt(gc_, XP*scale_, YP*scale_, WP, HP, new_gc, 0, 0, rgb->data_w(), rgb->data_h(), SRCCOPY); } RestoreDC(new_gc, save); DeleteDC(new_gc); @@ -601,7 +601,7 @@ static Fl_Bitmask fl_create_bitmap(int w, int h, const uchar *data) { fl_uintptr_t Fl_GDI_Graphics_Driver::cache(Fl_Bitmap *bm) { *cache_scale(bm) = Fl_Scalable_Graphics_Driver::scale(); - return (fl_uintptr_t)fl_create_bitmap(bm->pixel_w(), bm->pixel_h(), bm->array); + return (fl_uintptr_t)fl_create_bitmap(bm->data_w(), bm->data_h(), bm->array); } void Fl_GDI_Graphics_Driver::draw_unscaled(Fl_Pixmap *pxm, float s, int X, int Y, int W, int H, int cx, int cy) { @@ -646,7 +646,7 @@ void Fl_GDI_Printer_Graphics_Driver::draw_unscaled(Fl_Pixmap *pxm, float s, int fl_uintptr_t Fl_GDI_Graphics_Driver::cache(Fl_Pixmap *img) { - Fl_Image_Surface *surf = new Fl_Image_Surface(img->pixel_w(), img->pixel_h()); + Fl_Image_Surface *surf = new Fl_Image_Surface(img->data_w(), img->data_h()); Fl_Surface_Device::push_current(surf); uchar *bitmap = 0; Fl_Surface_Device::surface()->driver()->mask_bitmap(&bitmap); @@ -654,7 +654,7 @@ fl_uintptr_t Fl_GDI_Graphics_Driver::cache(Fl_Pixmap *img) { *Fl_Graphics_Driver::pixmap_bg_color(img) = Fl_WinAPI_System_Driver::win_pixmap_bg_color; // computed by fl_draw_pixmap() Fl_Surface_Device::surface()->driver()->mask_bitmap(0); if (bitmap) { - *Fl_Graphics_Driver::mask(img) = (fl_uintptr_t)fl_create_bitmask(img->pixel_w(), img->pixel_h(), bitmap); + *Fl_Graphics_Driver::mask(img) = (fl_uintptr_t)fl_create_bitmask(img->data_w(), img->data_h(), bitmap); delete[] bitmap; } Fl_Surface_Device::pop_current(); diff --git a/src/drivers/PostScript/Fl_PostScript_image.cxx b/src/drivers/PostScript/Fl_PostScript_image.cxx index 49cb9cebe..cc91f24da 100644 --- a/src/drivers/PostScript/Fl_PostScript_image.cxx +++ b/src/drivers/PostScript/Fl_PostScript_image.cxx @@ -574,7 +574,7 @@ void Fl_PostScript_Graphics_Driver::draw_image_mono(Fl_Draw_Image_Cb call, void void Fl_PostScript_Graphics_Driver::draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy){ int need_clip = cx || cy || WP != pxm->w() || HP != pxm->h(); if (need_clip) push_clip(XP, YP, WP, HP); - if (pxm->w() != pxm->pixel_w() || pxm->h() != pxm->pixel_h()) { + if (pxm->w() != pxm->data_w() || pxm->h() != pxm->data_h()) { draw_scaled(pxm, XP-cx, YP-cy, pxm->w(), pxm->h()); } else { const char * const * di =pxm->data(); @@ -596,7 +596,7 @@ void Fl_PostScript_Graphics_Driver::draw(Fl_RGB_Image * rgb,int XP, int YP, int { int need_clip = cx || cy || WP != rgb->w() || HP != rgb->h(); if (need_clip) push_clip(XP, YP, WP, HP); - if (rgb->w() != rgb->pixel_w() || rgb->h() != rgb->pixel_h()) { + if (rgb->w() != rgb->data_w() || rgb->h() != rgb->data_h()) { draw_scaled(rgb, XP-cx, YP-cy, rgb->w(), rgb->h()); } else { const uchar * di = rgb->array; @@ -618,10 +618,10 @@ int Fl_PostScript_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, in if (W == 0 || H == 0) return 1; push_no_clip(); // remove the FLTK clip that can't be rescaled clocale_printf("%d %d %i %i CL\n", X, Y, W, H); - clocale_printf("GS %d %d TR %f %f SC GS\n", XP, YP, float(WP)/img->pixel_w(), float(HP)/img->pixel_h()); + clocale_printf("GS %d %d TR %f %f SC GS\n", XP, YP, float(WP)/img->data_w(), float(HP)/img->data_h()); int keep_w = img->w(), keep_h = img->h(); - img->scale(img->pixel_w(), img->pixel_h(), 0, 1); - img->draw(0, 0, img->pixel_w(), img->pixel_h(), 0, 0); + img->scale(img->data_w(), img->data_h(), 0, 1); + img->draw(0, 0, img->data_w(), img->data_h(), 0, 0); clocale_printf("GR GR\n"); img->scale(keep_w, keep_h, 0, 1); pop_clip(); // restore FLTK's clip @@ -631,7 +631,7 @@ int Fl_PostScript_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, in void Fl_PostScript_Graphics_Driver::draw(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy) { int need_clip = cx || cy || WP != bitmap->w() || HP != bitmap->h(); if (need_clip) push_clip(XP, YP, WP, HP); - if (bitmap->w() != bitmap->pixel_w() || bitmap->h() != bitmap->pixel_h()) { + if (bitmap->w() != bitmap->data_w() || bitmap->h() != bitmap->data_h()) { draw_scaled(bitmap, XP-cx, YP-cy, bitmap->w(), bitmap->h()); } else { const uchar * di = bitmap->array; diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx index 1bd4d8fbc..db00f7935 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx @@ -162,7 +162,7 @@ void Fl_Quartz_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP, if (!cgimg) { CGColorSpaceRef lut = img->d()<=2 ? CGColorSpaceCreateDeviceGray() : CGColorSpaceCreateDeviceRGB(); int ld = img->ld(); - if (!ld) ld = img->pixel_w() * img->d(); + if (!ld) ld = img->data_w() * img->d(); CGDataProviderRef src; if ( has_feature(PRINTER) ) { // When printing, the data at img->array are used when the printed page is completed, @@ -172,16 +172,16 @@ void Fl_Quartz_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP, // is used to avoid repeating the copy operation if img is printed again. // The CGImage data provider deletes the copy at the latest of these two events: // deletion of img, and completion of the page where img was printed. - size_t total = ld * img->pixel_h(); + size_t total = ld * img->data_h(); uchar *copy = new uchar[total]; memcpy(copy, img->array, total); src = CGDataProviderCreateWithData(NULL, copy, total, dataReleaseCB); *Fl_Graphics_Driver::mask(img) = 1; } else { // the CGImage data provider must not release the image data. - src = CGDataProviderCreateWithData(NULL, img->array, ld * img->pixel_h(), NULL); + src = CGDataProviderCreateWithData(NULL, img->array, ld * img->data_h(), NULL); } - cgimg = CGImageCreate(img->pixel_w(), img->pixel_h(), 8, img->d()*8, ld, + cgimg = CGImageCreate(img->data_w(), img->data_h(), 8, img->d()*8, ld, lut, (img->d()&1)?kCGImageAlphaNone:kCGImageAlphaLast, src, 0L, false, kCGRenderingIntentDefault); *Fl_Graphics_Driver::id(img) = (fl_uintptr_t)cgimg; @@ -230,7 +230,7 @@ void Fl_Quartz_Graphics_Driver::uncache(Fl_RGB_Image*, fl_uintptr_t &id_, fl_uin } fl_uintptr_t Fl_Quartz_Graphics_Driver::cache(Fl_Bitmap *bm) { - return (fl_uintptr_t)create_bitmask(bm->pixel_w(), bm->pixel_h(), bm->array); + return (fl_uintptr_t)create_bitmask(bm->data_w(), bm->data_h(), bm->array); } @@ -239,7 +239,7 @@ static void pmProviderRelease (void *ctxt, const void *data, size_t size) { } fl_uintptr_t Fl_Quartz_Graphics_Driver::cache(Fl_Pixmap *img) { - Fl_Image_Surface *surf = new Fl_Image_Surface(img->pixel_w(), img->pixel_h()); + Fl_Image_Surface *surf = new Fl_Image_Surface(img->data_w(), img->data_h()); Fl_Surface_Device::push_current(surf); fl_draw_pixmap(img->data(), 0, 0, FL_BLACK); CGContextRef src = surf->get_offscreen_before_delete(); diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx index 0511dbfa0..902cb5e45 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx @@ -643,7 +643,7 @@ void Fl_Xlib_Graphics_Driver::draw_unscaled(Fl_Bitmap *bm, float s, int X, int Y // alpha compositing... static void alpha_blend(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, int cy) { int ld = img->ld(); - if (ld == 0) ld = img->pixel_w() * img->d(); + if (ld == 0) ld = img->data_w() * img->d(); uchar *srcptr = (uchar*)img->array + cy * ld + cx * img->d(); int srcskip = ld - img->d() * W; @@ -700,16 +700,16 @@ static Fl_Offscreen cache_rgb(Fl_RGB_Image *img) { Fl_Image_Surface *surface; int depth = img->d(); if (depth == 1 || depth == 3) { - surface = new Fl_Image_Surface(img->pixel_w(), img->pixel_h()); + surface = new Fl_Image_Surface(img->data_w(), img->data_h()); } else if (fl_can_do_alpha_blending()) { - Fl_Offscreen pixmap = XCreatePixmap(fl_display, RootWindow(fl_display, fl_screen), img->pixel_w(), img->pixel_h(), 32); - surface = new Fl_Image_Surface(img->pixel_w(), img->pixel_h(), 0, pixmap); + Fl_Offscreen pixmap = XCreatePixmap(fl_display, RootWindow(fl_display, fl_screen), img->data_w(), img->data_h(), 32); + surface = new Fl_Image_Surface(img->data_w(), img->data_h(), 0, pixmap); depth |= FL_IMAGE_WITH_ALPHA; } else { return 0; } Fl_Surface_Device::push_current(surface); - fl_draw_image(img->array, 0, 0, img->pixel_w(), img->pixel_h(), depth, img->ld()); + fl_draw_image(img->array, 0, 0, img->data_w(), img->data_h(), depth, img->ld()); Fl_Surface_Device::pop_current(); Fl_Offscreen off = surface->get_offscreen_before_delete(); delete surface; @@ -724,8 +724,8 @@ void Fl_Xlib_Graphics_Driver::draw_unscaled(Fl_RGB_Image *img, float s, int X, i Y = (Y+offset_y_)*s; cache_size(img, W, H); cx *= s; cy *= s; - if (W + cx > img->pixel_w()) W = img->pixel_w() - cx; - if (H + cy > img->pixel_h()) H = img->pixel_h() - cy; + if (W + cx > img->data_w()) W = img->data_w() - cx; + if (H + cy > img->data_h()) H = img->data_h() - cy; if (!*Fl_Graphics_Driver::id(img)) { *Fl_Graphics_Driver::id(img) = cache_rgb(img); *cache_scale(img) = 1; @@ -768,7 +768,7 @@ void Fl_Xlib_Graphics_Driver::uncache(Fl_RGB_Image*, fl_uintptr_t &id_, fl_uintp fl_uintptr_t Fl_Xlib_Graphics_Driver::cache(Fl_Bitmap *bm) { *cache_scale(bm) = Fl_Scalable_Graphics_Driver::scale(); - return (fl_uintptr_t)create_bitmask(bm->pixel_w(), bm->pixel_h(), bm->array); + return (fl_uintptr_t)create_bitmask(bm->data_w(), bm->data_h(), bm->array); } void Fl_Xlib_Graphics_Driver::draw_unscaled(Fl_Pixmap *pxm, float s, int X, int Y, int W, int H, int cx, int cy) { @@ -817,14 +817,14 @@ void Fl_Xlib_Graphics_Driver::draw_unscaled(Fl_Pixmap *pxm, float s, int X, int fl_uintptr_t Fl_Xlib_Graphics_Driver::cache(Fl_Pixmap *pxm) { - Fl_Image_Surface *surf = new Fl_Image_Surface(pxm->pixel_w(), pxm->pixel_h()); + Fl_Image_Surface *surf = new Fl_Image_Surface(pxm->data_w(), pxm->data_h()); Fl_Surface_Device::push_current(surf); uchar *bitmap = 0; Fl_Surface_Device::surface()->driver()->mask_bitmap(&bitmap); fl_draw_pixmap(pxm->data(), 0, 0, FL_BLACK); Fl_Surface_Device::surface()->driver()->mask_bitmap(0); if (bitmap) { - *Fl_Graphics_Driver::mask(pxm) = (fl_uintptr_t)create_bitmask(pxm->pixel_w(), pxm->pixel_h(), bitmap); + *Fl_Graphics_Driver::mask(pxm) = (fl_uintptr_t)create_bitmask(pxm->data_w(), pxm->data_h(), bitmap); delete[] bitmap; } Fl_Surface_Device::pop_current(); @@ -885,7 +885,7 @@ int Fl_Xlib_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, int WP, } cache_size(img, WP, HP); return scale_and_render_pixmap( *Fl_Graphics_Driver::id(rgb), rgb->d(), - rgb->pixel_w() / double(WP), rgb->pixel_h() / double(HP), 0, 0, (XP + offset_x_)*scale_, (YP + offset_y_)*scale_, WP, HP); + rgb->data_w() / double(WP), rgb->data_h() / double(HP), 0, 0, (XP + offset_x_)*scale_, (YP + offset_y_)*scale_, WP, HP); } #endif // HAVE_XRENDER |
