How and Why to make Abstraction by Object Encapsulation, with FB Syntax in UDTs (basics)

Forum for discussion about the documentation project.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: How and Why to make Abstraction by Object Encapsulation, with FB Syntax in UDTs (basics)

Post by dodicat »

OK, I have added 8 bytes all round in my above snippet.
Should now cover the full image area plus the header.
Thank you for pointing out the error.
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: How and Why to make Abstraction by Object Encapsulation, with FB Syntax in UDTs (basics)

Post by coderJeff »

The wiki shows the image buffer returned by ImageCreate as ANY PTR, however, it has a known public structure.
See: inc/fbgfx.bi
Also this tutorial: FBgfx Image and Font Buffers.
Maybe the wiki has historically, shown fb image buffers as ANY PTR only because fbgfx.bi and FB.Image type declaration is optional to the programmer.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: How and Why to make Abstraction by Object Encapsulation, with FB Syntax in UDTs (basics)

Post by fxm »

Indeed, ImageCreate() returns an Any Ptr.
I seem to remember that we discussed this topic (return either an Any Ptr or an Image Ptr) at time when adding the ImageCreate () statement, but I do not remember the reason of choice (maybe to avoid a Cast if the user want to use a numeric pointer).
Maybe dkl?
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: How and Why to make Abstraction by Object Encapsulation, with FB Syntax in UDTs (basics)

Post by coderJeff »

fxm wrote:maybe to avoid a Cast if the user want to use a numeric pointer
That would make sense. That image buffer data location could be declared as a variety of data types. BYTE PTR, array() as BYTE, etc.
kcvinu
Posts: 232
Joined: Oct 07, 2015 16:44
Location: Keralam, India

Re: How and Why to make Abstraction by Object Encapsulation, with FB Syntax in UDTs (basics)

Post by kcvinu »

I quit freebasic coding for about two years. But when i came back, what i can see is such great posts and comments. I feel sad that it's too late to read this. Thanks for this post.
Post Reply