Class CgDirectPalette?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Class CgDirectPalette?

Carl Gundel-2
The following method in CgPixmap uses a CgIndexedPalette whether or not the color depth is 1.  The problem with this is that I cannot paint with more than 16 colors.
 
Is CgDirectPalette the class that should be used instead?  I've tried to extend privateSetDefaultPalette to use CgDirectPalette when the depth > 256, but that doesn't work.
 
privateSetDefaultPalette
 "Select the default palette in the receiver."
 | palette |
 self depth = 1
  ifTrue: [palette := CgIndexedPalette blackAndWhite]
  ifFalse: [palette := CgIndexedPalette default].
 palette selectedIn: self.
 self selectedPalette: palette
 
Any ideas?
 
Thanks,
 
-Carl

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Cannot paint in more than 16 colors Re: Class CgDirectPalette?

Carl Gundel-2
What am I missing?  Sorry just being a squeaky wheel.
 
-Carl

On Thursday, March 6, 2014 2:54:08 PM UTC-5, Carl Gundel wrote:
The following method in CgPixmap uses a CgIndexedPalette whether or not the color depth is 1.  The problem with this is that I cannot paint with more than 16 colors.
 
Is CgDirectPalette the class that should be used instead?  I've tried to extend privateSetDefaultPalette to use CgDirectPalette when the depth > 256, but that doesn't work.
 
privateSetDefaultPalette
 "Select the default palette in the receiver."
 | palette |
 self depth = 1
  ifTrue: [palette := CgIndexedPalette blackAndWhite]
  ifFalse: [palette := CgIndexedPalette default].
 palette selectedIn: self.
 self selectedPalette: palette
 
Any ideas?
 
Thanks,
 
-Carl

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Cannot paint in more than 16 colors Re: Class CgDirectPalette?

Carl Gundel-2
What, nobody else needs to draw with more than 16 colors?  :-o
 
-Carl

On Thursday, March 13, 2014 11:50:11 AM UTC-4, Carl Gundel wrote:
What am I missing?  Sorry just being a squeaky wheel.
 
-Carl

On Thursday, March 6, 2014 2:54:08 PM UTC-5, Carl Gundel wrote:
The following method in CgPixmap uses a CgIndexedPalette whether or not the color depth is 1.  The problem with this is that I cannot paint with more than 16 colors.
 
Is CgDirectPalette the class that should be used instead?  I've tried to extend privateSetDefaultPalette to use CgDirectPalette when the depth > 256, but that doesn't work.
 
privateSetDefaultPalette
 "Select the default palette in the receiver."
 | palette |
 self depth = 1
  ifTrue: [palette := CgIndexedPalette blackAndWhite]
  ifFalse: [palette := CgIndexedPalette default].
 palette selectedIn: self.
 self selectedPalette: palette
 
Any ideas?
 
Thanks,
 
-Carl

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Class CgDirectPalette?

Louis LaBrunda
In reply to this post by Carl Gundel-2

Hi Carl,

I haven't actually done this but I don't see why it wouldn't work.  I think you do need to use a CgIndexedPalette but you may need to make your own.  Sorry, but I don't have time to play with it at the moment.

Lou


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Class CgDirectPalette?

Carl Gundel-2
Thanks Louis, but I cannot use an indexed palette.  I need to use arbitrary RGB colors.  What use is it to have a class named CgRGBColor when it doesn't work?  Here the original example I posted.  I am running a 32-bit screen depth, and the pixmap is 32-bit depth.  It refuses to paint with the color I specify.
 
Either I am doing something wrong, or else VAST is seriously broken.
 
| window pixmap result |
window := CgWindow default.
pixmap := CgPixmap screen: window screen.
result :=
pixmap
compatibleWith: window
width: 320
height: 240
depth: window depth.
pixmap fill: (CgRGBColor red: 16r9000 green: 16r0000 blue: 16r4000).
pixmap copyToClipboard
 
Thanks again,
 
-Carl

On Tuesday, March 18, 2014 11:55:50 AM UTC-4, Louis LaBrunda wrote:

Hi Carl,

I haven't actually done this but I don't see why it wouldn't work.  I think you do need to use a CgIndexedPalette but you may need to make your own.  Sorry, but I don't have time to play with it at the moment.

Lou


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Class CgDirectPalette?

Richard Sargent
Administrator
Carl,

If you haven't already, you might want to look at CgJPEGFileFormat to see how it uses a direct palette (set in CgJPEGFileFormat>>#setUpPalette).


On Tuesday, March 18, 2014 9:01:26 AM UTC-7, Carl Gundel wrote:
Thanks Louis, but I cannot use an indexed palette.  I need to use arbitrary RGB colors.  What use is it to have a class named CgRGBColor when it doesn't work?  Here the original example I posted.  I am running a 32-bit screen depth, and the pixmap is 32-bit depth.  It refuses to paint with the color I specify.
 
Either I am doing something wrong, or else VAST is seriously broken.
 
| window pixmap result |
window := CgWindow default.
pixmap := CgPixmap screen: window screen.
result :=
pixmap
compatibleWith: window
width: 320
height: 240
depth: window depth.
pixmap fill: (CgRGBColor red: 16r9000 green: 16r0000 blue: 16r4000).
pixmap copyToClipboard
 
Thanks again,
 
-Carl

On Tuesday, March 18, 2014 11:55:50 AM UTC-4, Louis LaBrunda wrote:

Hi Carl,

I haven't actually done this but I don't see why it wouldn't work.  I think you do need to use a CgIndexedPalette but you may need to make your own.  Sorry, but I don't have time to play with it at the moment.

Lou


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Class CgDirectPalette?

Carl Gundel-2
Thanks Richard,
 
I'm beginning to get the picture, but I am rather bewildered.
 
It seems like the only way to use a direct palette is to use it with an instance of CgDeviceIndependentImage.  This class isn't really good for much of anything because it doesn't know how to draw lines, boxes, text, etc.  Do I have to write code for these things myself?  I'm not sure where I would begin, especially with code to render text on a CgDeviceIndependentImage.
 
I'm rather discouraged to see that this is the state of graphics with VA Smalltalk.  A product this mature should be able to do these things very easily.  Smalltalk is supposed to make these things easy, and VA Smalltalk isn't living up to it.
 
-Carl

On Tuesday, March 18, 2014 5:59:20 PM UTC-4, Richard Sargent wrote:
Carl,

If you haven't already, you might want to look at CgJPEGFileFormat to see how it uses a direct palette (set in CgJPEGFileFormat>>#setUpPalette).


On Tuesday, March 18, 2014 9:01:26 AM UTC-7, Carl Gundel wrote:
Thanks Louis, but I cannot use an indexed palette.  I need to use arbitrary RGB colors.  What use is it to have a class named CgRGBColor when it doesn't work?  Here the original example I posted.  I am running a 32-bit screen depth, and the pixmap is 32-bit depth.  It refuses to paint with the color I specify.
 
Either I am doing something wrong, or else VAST is seriously broken.
 
| window pixmap result |
window := CgWindow default.
pixmap := CgPixmap screen: window screen.
result :=
pixmap
compatibleWith: window
width: 320
height: 240
depth: window depth.
pixmap fill: (CgRGBColor red: 16r9000 green: 16r0000 blue: 16r4000).
pixmap copyToClipboard
 
Thanks again,
 
-Carl

On Tuesday, March 18, 2014 11:55:50 AM UTC-4, Louis LaBrunda wrote:

Hi Carl,

I haven't actually done this but I don't see why it wouldn't work.  I think you do need to use a CgIndexedPalette but you may need to make your own.  Sorry, but I don't have time to play with it at the moment.

Lou


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Class CgDirectPalette?

dmacq
Hi Carl,

What exactly are you trying to do here? 

Donald

On Wednesday, March 19, 2014 9:58:11 AM UTC-4, Carl Gundel wrote:
Thanks Richard,
 
I'm beginning to get the picture, but I am rather bewildered.
 
It seems like the only way to use a direct palette is to use it with an instance of CgDeviceIndependentImage.  This class isn't really good for much of anything because it doesn't know how to draw lines, boxes, text, etc.  Do I have to write code for these things myself?  I'm not sure where I would begin, especially with code to render text on a CgDeviceIndependentImage.
 
I'm rather discouraged to see that this is the state of graphics with VA Smalltalk.  A product this mature should be able to do these things very easily.  Smalltalk is supposed to make these things easy, and VA Smalltalk isn't living up to it.
 
-Carl

On Tuesday, March 18, 2014 5:59:20 PM UTC-4, Richard Sargent wrote:
Carl,

If you haven't already, you might want to look at CgJPEGFileFormat to see how it uses a direct palette (set in CgJPEGFileFormat>>#setUpPalette).


On Tuesday, March 18, 2014 9:01:26 AM UTC-7, Carl Gundel wrote:
Thanks Louis, but I cannot use an indexed palette.  I need to use arbitrary RGB colors.  What use is it to have a class named CgRGBColor when it doesn't work?  Here the original example I posted.  I am running a 32-bit screen depth, and the pixmap is 32-bit depth.  It refuses to paint with the color I specify.
 
Either I am doing something wrong, or else VAST is seriously broken.
 
| window pixmap result |
window := CgWindow default.
pixmap := CgPixmap screen: window screen.
result :=
pixmap
compatibleWith: window
width: 320
height: 240
depth: window depth.
pixmap fill: (CgRGBColor red: 16r9000 green: 16r0000 blue: 16r4000).
pixmap copyToClipboard
 
Thanks again,
 
-Carl

On Tuesday, March 18, 2014 11:55:50 AM UTC-4, Louis LaBrunda wrote:

Hi Carl,

I haven't actually done this but I don't see why it wouldn't work.  I think you do need to use a CgIndexedPalette but you may need to make your own.  Sorry, but I don't have time to play with it at the moment.

Lou


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Class CgDirectPalette?

Carl Gundel-2
Hi Donald,
 
I have an application in VisualSmalltalk that I am porting to VA Smalltalk.  I have a lot of code which does different kinds of graphics drawing.  There is plentiful use of RGB colors.  The objects in VA Smalltalk (meaning Pixmap) that are useful for drawing the various kinds of things such as text, boxes, lines, etc. don't work properly with RGB colors because Pixmaps don't work with a direct palette.  These objects want to use an indexed palette.
 
The code examples that I see are very convoluted.  Want to use RGB colors?  You can!  First create an instance of CgDeviceIndependentImage.  You can paint a single pixel at a time with an RGB value (that's put forward with a straight face?) and then copy this onto a Pixmap.  I mean, come on.
 
For reference, in VisualSmalltalk I only need to do something like this and it draws Hello World! with exactly the RGB color I specify.
 
| bmp pen |
bmp := Bitmap width: 100 height: 100 planes: 1 bitCount: 24.
pen := bmp pen.
pen foreColor: (RGBColor red: 16rC0 green: 16r0 blue: 16rC0);
    displayText: 'Hello World!' at: 10 @ 20.
Why does it need to be harder than this?  If it were simply a matter of writing two or three times as many lines of code then I wouldn't object, but it seems like the solution is more trouble than it is worth.
 
Simple things should be simple, complex things should be possible. - Alan Kay
 
This is a simple thing, made complex.
 
Sorry, I'll stop ranting now.
 
Thanks,
 
-Carl

On Wednesday, March 19, 2014 10:08:27 AM UTC-4, Donald MacQueen wrote:
Hi Carl,

What exactly are you trying to do here? 

Donald

On Wednesday, March 19, 2014 9:58:11 AM UTC-4, Carl Gundel wrote:
Thanks Richard,
 
I'm beginning to get the picture, but I am rather bewildered.
 
It seems like the only way to use a direct palette is to use it with an instance of CgDeviceIndependentImage.  This class isn't really good for much of anything because it doesn't know how to draw lines, boxes, text, etc.  Do I have to write code for these things myself?  I'm not sure where I would begin, especially with code to render text on a CgDeviceIndependentImage.
 
I'm rather discouraged to see that this is the state of graphics with VA Smalltalk.  A product this mature should be able to do these things very easily.  Smalltalk is supposed to make these things easy, and VA Smalltalk isn't living up to it.
 
-Carl

On Tuesday, March 18, 2014 5:59:20 PM UTC-4, Richard Sargent wrote:
Carl,

If you haven't already, you might want to look at CgJPEGFileFormat to see how it uses a direct palette (set in CgJPEGFileFormat>>#setUpPalette).


On Tuesday, March 18, 2014 9:01:26 AM UTC-7, Carl Gundel wrote:
Thanks Louis, but I cannot use an indexed palette.  I need to use arbitrary RGB colors.  What use is it to have a class named CgRGBColor when it doesn't work?  Here the original example I posted.  I am running a 32-bit screen depth, and the pixmap is 32-bit depth.  It refuses to paint with the color I specify.
 
Either I am doing something wrong, or else VAST is seriously broken.
 
| window pixmap result |
window := CgWindow default.
pixmap := CgPixmap screen: window screen.
result :=
pixmap
compatibleWith: window
width: 320
height: 240
depth: window depth.
pixmap fill: (CgRGBColor red: 16r9000 green: 16r0000 blue: 16r4000).
pixmap copyToClipboard
 
Thanks again,
 
-Carl

On Tuesday, March 18, 2014 11:55:50 AM UTC-4, Louis LaBrunda wrote:

Hi Carl,

I haven't actually done this but I don't see why it wouldn't work.  I think you do need to use a CgIndexedPalette but you may need to make your own.  Sorry, but I don't have time to play with it at the moment.

Lou


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.