void TestWidget::CreateImageBuffer() { // clear itsImageBuffer so Draw() will work correctly jdelete itsImageBuffer; itsImageBuffer = NULL; // create image const JRect bounds = GetBounds(); JXImage* imageBuffer = jnew JXImage(GetDisplay(), bounds.width(), bounds.height()); assert( imageBuffer != NULL ); imageBuffer->SetDefaultState(JXImage::kRemoteStorage); // draw to image JXImagePainter* p = imageBuffer->CreatePainter(); Draw(*p, GetBounds()); jdelete p; // save object itsImageBuffer = imageBuffer; }
GMMessageDragSource::GMMessageDragSource ( GMessageViewDir* dir, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXImageWidget(enclosure, hSizing, vSizing, x,y, w,h) { itsDir = dir; JXImage* icon = new JXImage(GetDisplay(), envelope_front); assert( icon != NULL ); icon->ConvertToRemoteStorage(); SetImage(icon, kJTrue); SetHint(kHintText); SetBorderWidth(0); // targets for DND itsMessageXAtom = GetDisplay()->RegisterXAtom(kDragMessagesXAtomName); }
void SVNTabGroup::DrawTab ( const JIndex index, JXWindowPainter& p, const JRect& rect, const Edge edge ) { if (index == itsBusyIndex) { JXImage* image = itsImageList->NthElement(itsSpinnerIndex); p.JPainter::Image(*image, image->GetBounds(), rect.left + kMarginWidth, rect.ycenter() - (image->GetHeight()/2)); } }
XImage* JXImage::CreateXImage() const { if (itsPixmap == None) { JXImage* me = const_cast<JXImage*>(this); me->ConvertToPixmap(); } XImage* image = XGetImage(*itsDisplay, itsPixmap, 0,0, GetWidth(), GetHeight(), AllPlanes, ZPixmap); assert( image != NULL ); return image; }
unsigned long JXImage::GetSystemColor ( const JCoordinate x, const JCoordinate y ) const { if (itsImage == NULL) { JXImage* me = const_cast<JXImage*>(this); me->ConvertToImage(); } return XGetPixel(itsImage, x,y); }
JXImage::JXImage ( const JXImage& source, const JRect& rect ) : JImage(rect.width(), rect.height(), source.GetColormap()) { JXImageX(source.itsDisplay, source.itsColormap, source.itsDepth); itsDefState = source.itsDefState; if (source.itsGC != NULL) { ForcePrivateGC(); } Pixmap sourcePixmap; if (source.itsPixmap != None) { sourcePixmap = source.itsPixmap; } else { sourcePixmap = source.CreatePixmap(); } itsPixmap = XCreatePixmap(*itsDisplay, itsDisplay->GetRootWindow(), GetWidth(), GetHeight(), itsDepth); assert( itsPixmap != None ); (GetGC())->CopyPixels(sourcePixmap, rect.left, rect.top, GetWidth(), GetHeight(), itsPixmap, 0,0); if (source.itsPixmap == None) { XFreePixmap(*itsDisplay, sourcePixmap); } if (source.itsMask != NULL) { itsMask = new JXImageMask(*(source.itsMask), rect); assert( itsMask != NULL ); } CopyColorList(source); }
JXImageSelection::JXImageSelection ( const JXImage& image ) : JXSelectionData(image.GetDisplay()) { itsImage = NULL; SetData(image); }
void JXTextMenu::SetItemImage ( const JIndex index, const JXPM& data ) { JXImage* image = GetDisplay()->GetImageCache()->GetImage(data); if (image->GetXColormap() == GetColormap()) { SetItemImage(index, image, kJFalse); } else { JXImage* image = jnew JXImage(GetDisplay(), data); assert( image != NULL ); SetItemImage(index, image, kJTrue); } }
GMAboutDialogIconTask::GMAboutDialogIconTask ( JXImageWidget* widget ) : JXAnimationTask(widget) { itsImageList = new JPtrArray<JXImage>(JPtrArrayT::kForgetAll, kAboutIconCount); assert( itsImageList != NULL ); JXDisplay* display = widget->GetDisplay(); JXColormap* colormap = widget->GetColormap(); for (JIndex i=1; i<=kAboutIconCount; i++) { JXImage* icon = new JXImage(display, kAboutIcon[i-1]); assert( icon != NULL ); icon->ConvertToRemoteStorage(); itsImageList->Append(icon); } }
JXImage::JXImage ( const JXImage& source ) : JImage(source) { JXImageX(source.itsDisplay, source.itsColormap, source.itsDepth); itsDefState = source.itsDefState; if (source.itsGC != NULL) { ForcePrivateGC(); } if (source.itsPixmap != None) { itsPixmap = source.CreatePixmap(); } if (source.itsImage != NULL) { Pixmap tempPixmap = source.CreatePixmap(); itsImage = XGetImage(*itsDisplay, tempPixmap, 0,0, GetWidth(), GetHeight(), AllPlanes, ZPixmap); assert( itsImage != NULL ); XFreePixmap(*itsDisplay, tempPixmap); } if (source.itsMask != NULL) { itsMask = new JXImageMask(*(source.itsMask)); assert( itsMask != NULL ); } CopyColorList(source); }