Handle Window_icon( Handle self, Bool set, Handle icon) { if ( var-> stage > csFrozen) return nilHandle; if ( !set) { if ( apc_window_get_icon( self, nilHandle)) { HV * profile = newHV(); Handle i = Object_create( "Prima::Icon", profile); sv_free(( SV *) profile); apc_window_get_icon( self, i); --SvREFCNT( SvRV((( PAnyObject) i)-> mate)); return i; } else return nilHandle; } if ( icon && !kind_of( icon, CImage)) { warn("Illegal object reference passed to Window::icon"); return nilHandle; } my-> first_that( self, (void*)icon_notify, (void*)icon); apc_window_set_icon( self, icon); opt_clear( optOwnerIcon); return nilHandle; }
Handle Widget_shape( Handle self, Bool set, Handle mask) { if ( var-> stage > csFrozen) return nilHandle; if ( !set) { if ( apc_widget_get_shape( self, nilHandle)) { HV * profile = newHV(); Handle i = Object_create( "Prima::Image", profile); sv_free(( SV *) profile); apc_widget_get_shape( self, i); --SvREFCNT( SvRV((( PAnyObject) i)-> mate)); return i; } else return nilHandle; } if ( mask && !kind_of( mask, CImage)) { warn("RTC008A: Illegal object reference passed to Widget::shape"); return nilHandle; } if ( mask && (( PImage( mask)-> type & imBPP) != imbpp1)) { Handle i = CImage( mask)-> dup( mask); ++SvREFCNT( SvRV( PImage( i)-> mate)); CImage( i)-> set_conversion( i, ictNone); CImage( i)-> set_type( i, imBW); apc_widget_set_shape( self, i); --SvREFCNT( SvRV( PImage( i)-> mate)); Object_destroy( i); } else apc_widget_set_shape( self, mask); return nilHandle; }
Handle Widget_pointerIcon( Handle self, Bool set, Handle icon) { enter_method; Point hotSpot; if ( var-> stage > csFrozen) return nilHandle; if ( !set) { HV * profile = newHV(); Handle icon = Object_create( "Prima::Icon", profile); sv_free(( SV *) profile); apc_pointer_get_bitmap( self, icon); --SvREFCNT( SvRV((( PAnyObject) icon)-> mate)); return icon; } if ( icon != nilHandle && !kind_of( icon, CIcon)) { warn("RTC083: Illegal object reference passed to Widget::pointerIcon"); return nilHandle; } hotSpot = my-> get_pointerHotSpot( self); apc_pointer_set_user( self, icon, hotSpot); if ( var-> pointerType == crUser) my-> first_that( self, (void*)sptr, nil); return nilHandle; }
static SV * image_server( Handle self, PClipboardFormatReg instance, int function, SV * data) { ClipboardDataRec c; switch( function) { case cefInit: return ( SV *) cfBitmap; case cefFetch: { HV * profile = newHV(); c. image = Object_create( "Prima::Image", profile); sv_free(( SV *) profile); if ( apc_clipboard_get_data( self, cfBitmap, &c)) { --SvREFCNT( SvRV( PImage(c. image)-> mate)); return newSVsv( PImage(c. image)-> mate); } Object_destroy( c. image); } break; case cefStore: c. image = gimme_the_mate( data); if ( !kind_of( c. image, CImage)) { warn("Not an image passed to clipboard"); return nilSV; } instance-> success = apc_clipboard_set_data( self, cfBitmap, &c); instance-> written = true; break; } return nilSV; }
int main(int argc, char* argv[]) { #if 1 Object* objA = Object_create(); Object* objB = objA->ref(objA); Object* objC = objB->ref(objB); //*/ objA->unref(objA); objA = NULL; objB->unref(objB); objB = NULL; objC->unref(objC); objC = NULL; /*/ objA->destroy(objA); //*/ #else AbstractPlayer* con = NULL; MyPlayer* player = NULL; ChildPlayer* child = NULL; /* The first sample. */ con = ConcretePlayer_create(); if (con->open(con, "Abstract & Concrete") == true) { con->play(con); con->close(con); } if (con->destroy(con) == true) { con = NULL; } /* The second sample. */ player = MyPlayer_create(); if (player->open(player, "This is my player.") == true) { player->play(player); player->pause(player); player->close(player); } if (player->destroy(player) == true) { player = NULL; } /* The third sample. */ child = ChildPlayer_create(); if (child->open(child, "This is Mr. Child.") == true) { child->play(child); child->pause(child); child->play(child); child->setSpeed(child, 1024); child->close(child); } if (child->destroy(child) == true) { child = NULL; } #endif return 0; }
Handle Application_get_image( Handle self, int x, int y, int xLen, int yLen) { HV * profile; Handle i; Bool ret; Point sz; if ( var-> stage > csFrozen) return nilHandle; if ( x < 0 || y < 0 || xLen <= 0 || yLen <= 0) return nilHandle; sz = apc_application_get_size( self); if ( x + xLen > sz. x) xLen = sz. x - x; if ( y + yLen > sz. y) yLen = sz. y - y; if ( x >= sz. x || y >= sz. y || xLen <= 0 || yLen <= 0) return nilHandle; profile = newHV(); i = Object_create( "Prima::Image", profile); sv_free(( SV *) profile); ret = apc_application_get_bitmap( self, i, x, y, xLen, yLen); --SvREFCNT( SvRV((( PAnyObject) i)-> mate)); return ret ? i : nilHandle; }
static Handle xdup( Handle self, char * className) { Handle h; PDrawable i; HV * profile = newHV(); Point s; pset_H( owner, var-> owner); pset_i( width, var-> w); pset_i( height, var-> h); pset_i( type, var-> monochrome ? imMono : imRGB); h = Object_create( className, profile); sv_free(( SV *) profile); i = ( PDrawable) h; s = i-> self-> get_size( h); i-> self-> begin_paint( h); i-> self-> put_image_indirect( h, self, 0, 0, 0, 0, s.x, s.y, s.x, s.y, ropCopyPut); i-> self-> end_paint( h); --SvREFCNT( SvRV( i-> mate)); return h; }