This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Surface problem


Surface problem

Postby Lexx31337 » Apr 24, 2006 @ 4:25pm

Hi every1 !
Sorry for my bad english... :) Let's speak in С++ lang :)

i have a problem with creation of a new surface:

1:
Surface * pTexture1 = LoadImage("..."); //first sprite
pTexture1->SetColorMask( Color(0,0,0) ); //setup alpha
//and second sprite:
Surface * pTexture2 = new Surface(100,100);
Rasterizer pRast = Rasterizer(pTexture2);
pRast.Clear(Color(0,0,0));
pRast.Blit( 0, 0, pTexture1 ); // try to copy first image into second
// and now, pTexture2 has no "m_colorMask" from first image... my error?

So... how i can transfer part of image into another inage WITH ALPHA-DATA ?


2: Let's see at Surface.h and Surface.cpp in the PocketFrog (i have v.0.8.1)

// class description:
// Surface.h
class Surface : PHAL::NonCopyable
{
...
private:
...
unsigned m_colorMask; // Source color key
}

//and...
// default constructor of this class:
// Surface.cpp
Surface::Surface( unsigned width, unsigned height )
: m_buffer( PHAL::Surface::Create( width, height ) ),
m_colorMask( -1 ),// is it right? "-1"
m_original( 0 ),
m_hdc( 0 )
{
}


3:
In some part of my engine, i create MANY sprites (something about 3~6 Mb, yeah, i'm crazy, and my Fujitsu (PDA) thinks same... :D ). I have a free memory, but Surface * pSurface = new Surface(512,512) returns pointer with m_buffer=NULL ! Also, sometimes, i can't create sprite with GREAT SIZE (1000x1600). There's a PHAL - limitation? Or it's my errors? I can't use many small sprites instead one big (programm limitation...). Help me plz!

How many mistakes in my english i have? Is it very bad? :)
Lexx31337
pm Member
 
Posts: 2
Joined: Apr 24, 2006 @ 3:49pm
Location: RUS


Postby BIGBEN » Apr 24, 2006 @ 7:52pm

User avatar
BIGBEN
pm Member
 
Posts: 281
Joined: Mar 18, 2003 @ 10:18pm
Location: Saint-Petersburg, Russia


Postby Lexx31337 » Apr 25, 2006 @ 5:21am

Hi BIGBEN! Spb? :)
so... in my first sprite a have some image(some part of this image has black color, it will be transparent SetColorMask( Color(0,0,0) ). After copy this image to second sprite, i have same image, BUT ! it's has no right value in m_colorMask! In second image a have undefined value (345467676233... something like that), cos in default constructor something wrong ( unsigned m_colorMask = -1 ) and function pRast.Blit( 0, 0, pTexture1 ) does not copy it from first sprite... I try with some colorMask, but it's not work...
I have same problem, when i load 16-bit image (R5G5B5) and try to set colorMask (SetColorMask( Color(...))), after drawing to screen, image has no transparent parts... This problem has gone, when i use 24-bit image...
Lexx31337
pm Member
 
Posts: 2
Joined: Apr 24, 2006 @ 3:49pm
Location: RUS


Postby BIGBEN » Apr 25, 2006 @ 11:52am

User avatar
BIGBEN
pm Member
 
Posts: 281
Joined: Mar 18, 2003 @ 10:18pm
Location: Saint-Petersburg, Russia


Re: Surface problem

Postby BradK3 » Apr 26, 2006 @ 3:01pm

User avatar
BradK3
pm Member
 
Posts: 19
Joined: May 27, 2003 @ 7:34pm
Location: Clearfield, Utah


Return to PocketFrog & PocketHAL


Sort


Forum Description

SDKs for fast and robust device-independent access to Pocket PC display hardware.

Moderators:

sponge, Kzinti

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron