Click here to Skip to main content
15,893,668 members
Home / Discussions / Graphics
   

Graphics

 
GeneralRe: Problem extracting full palette from 8bit image Pin
Mark Salsbery4-Jun-07 9:28
Mark Salsbery4-Jun-07 9:28 
GeneralRe: Problem extracting full palette from 8bit image Pin
Sepharo4-Jun-07 9:40
Sepharo4-Jun-07 9:40 
GeneralRe: Problem extracting full palette from 8bit image Pin
Mark Salsbery4-Jun-07 9:44
Mark Salsbery4-Jun-07 9:44 
GeneralRe: Problem extracting full palette from 8bit image Pin
Mark Salsbery4-Jun-07 9:36
Mark Salsbery4-Jun-07 9:36 
GeneralRe: Problem extracting full palette from 8bit image Pin
Sepharo4-Jun-07 9:42
Sepharo4-Jun-07 9:42 
QuestionWinamp like credits? Pin
Stevie4-Jun-07 1:05
Stevie4-Jun-07 1:05 
QuestionHow to create a dynamic array of direct draw surfaces [modified] Pin
GTaylor552-Jun-07 15:50
GTaylor552-Jun-07 15:50 
AnswerRe: A Workaround solution Pin
GTaylor554-Jun-07 0:33
GTaylor554-Jun-07 0:33 
In case anyone is interested in a solution I have figured out a workaround by modifying my static array solution.
I changed the array definition and the LoadImage method to use a new method called GrowImageArray.

This new method

  • Creates a new array to the new dimension
  • Copies all the surfaces from the old array into the new
  • Adds the new surface to the new array
  • Returns the new array to the LoadImage Method



    I realize that this is probably not the best way to achieve my goal, but the 'best way' is not important to me at this stage because this is an experience gaining exercise

    private Surface[] ImgList = null;//create an emty array
    ...
    
    public int LoadImage(string FileName)
    {   
        sDesc.Clear();   
        sDesc.SurfaceCaps.OffScreenPlain = true;  
        NumImages+= 1; 
        ImgList= GrowImageArray(FileName,ImgList, NumImages);
        return NumImages;
    }
    
    private Surface[] GrowImageArray(string FileName,Surface[] pOldArray, Int32 pNewSize)
    {
                Int32 counter = 0;
                Surface[] newArray = new Surface[pNewSize];// Create the new array to the new dimension
    
        //
        //Copy the surfaces from the old array to the new array
                if (pNewSize > 1)
                {
                    foreach (Surface item in pOldArray)
                    {
                        newArray[counter] = item;
                        counter += 1;
                    }
                }
    
                newArray[counter] = new Surface(FileName, sdesc, dddevice);//Add the new image to the last element
                return newArray;
    } 
    
    public void DrawImage(int Image,int x,int y)
    {
        //Draw the surface in the array indexed by the Image parameter       
        ssurf.DrawFast(0, 0, ImgList[Image-1],ImageRect,DrawFastFlags.DoNotWait);
    }


    PS
    I am still interested to find out how to achieve this with ArrayList?

  • GeneralRe: A Workaround solution Pin
    XTAL2564-Jun-07 2:47
    XTAL2564-Jun-07 2:47 
    AnswerRe: The Solution Pin
    GTaylor5514-Jun-07 0:53
    GTaylor5514-Jun-07 0:53 
    QuestionBlank Image Detection Pin
    JoeGonzalez2-Jun-07 7:24
    JoeGonzalez2-Jun-07 7:24 
    Questionpbuffers [modified] Pin
    XTAL2561-Jun-07 14:59
    XTAL2561-Jun-07 14:59 
    QuestionNewbie Camera Math Question Pin
    joshp12171-Jun-07 9:05
    joshp12171-Jun-07 9:05 
    QuestionCropping Surrounding White Area Pin
    zubair_ahmed31-May-07 20:56
    zubair_ahmed31-May-07 20:56 
    AnswerRe: Cropping Surrounding White Area Pin
    Mark Salsbery1-Jun-07 5:06
    Mark Salsbery1-Jun-07 5:06 
    AnswerRe: Cropping Surrounding White Area Pin
    Ian Shlasko1-Jun-07 7:13
    Ian Shlasko1-Jun-07 7:13 
    QuestionPath.IsVisible() Problem! Pin
    nermsk30-May-07 11:22
    nermsk30-May-07 11:22 
    AnswerRe: Path.IsVisible() Problem! Pin
    Mark Salsbery30-May-07 15:31
    Mark Salsbery30-May-07 15:31 
    GeneralRe: Path.IsVisible() Problem! Pin
    nermsk30-May-07 20:29
    nermsk30-May-07 20:29 
    GeneralRe: Path.IsVisible() Problem! Pin
    nermsk31-May-07 10:26
    nermsk31-May-07 10:26 
    QuestionLooking for bit depth conversion library/class Pin
    Sepharo30-May-07 5:51
    Sepharo30-May-07 5:51 
    QuestionPhotoshop...Help Pin
    friendship30-May-07 0:37
    friendship30-May-07 0:37 
    AnswerRe: Photoshop...Help Pin
    bigphish10-Jun-07 20:11
    bigphish10-Jun-07 20:11 
    AnswerRe: Photoshop...Help Pin
    Drew Stainton17-Jul-07 19:55
    Drew Stainton17-Jul-07 19:55 
    Question8 bit bmp Pin
    himuskanhere29-May-07 20:56
    himuskanhere29-May-07 20:56 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.